forked from Mirrors/freeswitch
Port mrene's changes to ozmod_isdn:
Add "opts" parameter to span definition in pri_spans (removing suggest-channel parameter) Possible options are: suggest_channel - No idea what this one actually does... disable_tones - Disable tone generating thread in NT (net) mode omit_display - Disable sending caller name in call setup message (Display IE) git-svn-id: http://svn.openzap.org/svn/openzap/trunk@702 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
a6672fc558
commit
03dbc587fd
@ -1850,8 +1850,8 @@ static switch_status_t load_config(void)
|
||||
zap_span_t *span = NULL;
|
||||
const char *tonegroup = NULL;
|
||||
char *digit_timeout = NULL;
|
||||
const char *opts = "none";
|
||||
uint32_t to = 0;
|
||||
uint32_t opts = 0;
|
||||
int q921loglevel = -1;
|
||||
int q931loglevel = -1;
|
||||
// quick debug
|
||||
@ -1877,8 +1877,8 @@ static switch_status_t load_config(void)
|
||||
}
|
||||
} else if (!strcasecmp(var, "context")) {
|
||||
context = val;
|
||||
} else if (!strcasecmp(var, "suggest-channel") && switch_true(val)) {
|
||||
opts |= 1;
|
||||
} else if (!strcasecmp(var, "opts")) {
|
||||
opts = val;
|
||||
} else if (!strcasecmp(var, "dialplan")) {
|
||||
dialplan = val;
|
||||
} else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) {
|
||||
|
@ -341,11 +341,13 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request)
|
||||
/*
|
||||
* Display IE
|
||||
*/
|
||||
Q931InitIEDisplay(&Display);
|
||||
Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name);
|
||||
gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display);
|
||||
ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf);
|
||||
zap_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name)+1);
|
||||
if (!(isdn_data->opts & ZAP_ISDN_OPT_OMIT_DISPLAY_IE)) {
|
||||
Q931InitIEDisplay(&Display);
|
||||
Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name);
|
||||
gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display);
|
||||
ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf);
|
||||
zap_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name)+1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Calling Number IE
|
||||
@ -1214,12 +1216,14 @@ static __inline__ void state_advance(zap_channel_t *zchan)
|
||||
|
||||
/*
|
||||
* Display IE
|
||||
*/
|
||||
Q931InitIEDisplay(&Display);
|
||||
Display.Size = Display.Size + (unsigned char)strlen(zchan->caller_data.cid_name);
|
||||
gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display);
|
||||
ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf);
|
||||
zap_copy_string((char *)ptrDisplay->Display, zchan->caller_data.cid_name, strlen(zchan->caller_data.cid_name)+1);
|
||||
*/
|
||||
if (!(isdn_data->opts & ZAP_ISDN_OPT_OMIT_DISPLAY_IE)) {
|
||||
Q931InitIEDisplay(&Display);
|
||||
Display.Size = Display.Size + (unsigned char)strlen(zchan->caller_data.cid_name);
|
||||
gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display);
|
||||
ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf);
|
||||
zap_copy_string((char *)ptrDisplay->Display, zchan->caller_data.cid_name, strlen(zchan->caller_data.cid_name)+1);
|
||||
}
|
||||
|
||||
/*
|
||||
* CallingNum IE
|
||||
@ -1947,13 +1951,34 @@ static zap_status_t zap_isdn_start(zap_span_t *span)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(ZAP_SPAN_IS_NT(span)) {
|
||||
if (ZAP_SPAN_IS_NT(span) && !(isdn_data->opts & ZAP_ISDN_OPT_DISABLE_TONES)) {
|
||||
ret = zap_thread_create_detached(zap_isdn_tones_run, span);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint32_t parse_opts(const char *in)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (!in) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strstr(in, "suggest_channel")) {
|
||||
flags |= ZAP_ISDN_OPT_SUGGEST_CHANNEL;
|
||||
}
|
||||
|
||||
if (strstr(in, "omit_display")) {
|
||||
flags |= ZAP_ISDN_OPT_OMIT_DISPLAY_IE;
|
||||
}
|
||||
|
||||
if (strstr(in, "disable_tones")) {
|
||||
flags |= ZAP_ISDN_OPT_DISABLE_TONES;
|
||||
}
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||
{
|
||||
@ -1963,7 +1988,6 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||
const char *tonemap = "us";
|
||||
char *var, *val;
|
||||
Q931Dialect_t dialect = Q931_Dialect_National;
|
||||
uint32_t opts = 0;
|
||||
int32_t digit_timeout = 0;
|
||||
int q921loglevel = -1;
|
||||
int q931loglevel = -1;
|
||||
@ -2052,11 +2076,10 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||
return ZAP_FAIL;
|
||||
}
|
||||
} else if (!strcasecmp(var, "opts")) {
|
||||
opts = va_arg(ap, uint32_t);
|
||||
if (opts >= ZAP_ISDN_OPT_MAX) {
|
||||
return ZAP_FAIL;
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
}
|
||||
isdn_data->opts = opts;
|
||||
isdn_data->opts = parse_opts(val);
|
||||
} else if (!strcasecmp(var, "tonemap")) {
|
||||
if (!(val = va_arg(ap, char *))) {
|
||||
break;
|
||||
@ -2156,7 +2179,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_isdn_configure_span)
|
||||
span->signal_type = ZAP_SIGTYPE_ISDN;
|
||||
span->outgoing_call = isdn_outgoing_call;
|
||||
|
||||
if ((opts & ZAP_ISDN_OPT_SUGGEST_CHANNEL)) {
|
||||
if ((isdn_data->opts & ZAP_ISDN_OPT_SUGGEST_CHANNEL)) {
|
||||
span->channel_request = isdn_channel_request;
|
||||
span->suggest_chan_id = 1;
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
typedef enum {
|
||||
ZAP_ISDN_OPT_NONE = 0,
|
||||
ZAP_ISDN_OPT_SUGGEST_CHANNEL = (1 << 0),
|
||||
ZAP_ISDN_OPT_OMIT_DISPLAY_IE = (1 << 1), /*!< Do not send Caller name in outgoing SETUP message (= Display IE) */
|
||||
ZAP_ISDN_OPT_DISABLE_TONES = (1 << 2), /*!< Disable tone generating thread (NT mode) */
|
||||
|
||||
ZAP_ISDN_OPT_MAX = (2 << 0)
|
||||
} zap_isdn_opts_t;
|
||||
|
Loading…
Reference in New Issue
Block a user