Changed zap_channel_set_caller_data
Set default NPI to e164 and default TON to national git-svn-id: http://svn.openzap.org/svn/openzap/trunk@1042 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
a825c1bbf5
commit
c34e5320d3
|
@ -1254,7 +1254,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
|
|
||||||
if (chan_id) {
|
if (chan_id) {
|
||||||
status = zap_channel_open(span_id, chan_id, &zchan);
|
status = zap_channel_open(span_id, chan_id, &zchan);
|
||||||
zap_set_caller_data(span_id, &caller_data);
|
|
||||||
} else {
|
} else {
|
||||||
status = zap_channel_open_any(span_id, direction, &caller_data, &zchan);
|
status = zap_channel_open_any(span_id, direction, &caller_data, &zchan);
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1303,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
||||||
switch_channel_set_variable(channel, "openzap_span_name", zchan->span->name);
|
switch_channel_set_variable(channel, "openzap_span_name", zchan->span->name);
|
||||||
switch_channel_set_variable_printf(channel, "openzap_span_number", "%d", zchan->span_id);
|
switch_channel_set_variable_printf(channel, "openzap_span_number", "%d", zchan->span_id);
|
||||||
switch_channel_set_variable_printf(channel, "openzap_chan_number", "%d", zchan->chan_id);
|
switch_channel_set_variable_printf(channel, "openzap_chan_number", "%d", zchan->chan_id);
|
||||||
zchan->caller_data = caller_data;
|
zap_channel_set_caller_data(zchan, &caller_data);
|
||||||
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
|
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
|
||||||
switch_channel_set_caller_profile(channel, caller_profile);
|
switch_channel_set_caller_profile(channel, caller_profile);
|
||||||
tech_pvt->caller_profile = caller_profile;
|
tech_pvt->caller_profile = caller_profile;
|
||||||
|
@ -2434,12 +2433,12 @@ static switch_status_t load_config(void)
|
||||||
zap_status_t zstatus = ZAP_FAIL;
|
zap_status_t zstatus = ZAP_FAIL;
|
||||||
const char *context = "default";
|
const char *context = "default";
|
||||||
const char *dialplan = "XML";
|
const char *dialplan = "XML";
|
||||||
const char *outbound_called_ton = "unknown";
|
const char *outbound_called_ton = "national";
|
||||||
const char *outbound_called_npi = "unknown";
|
const char *outbound_called_npi = "isdn";
|
||||||
const char *outbound_calling_ton = "unknown";
|
const char *outbound_calling_ton = "national";
|
||||||
const char *outbound_calling_npi = "unknown";
|
const char *outbound_calling_npi = "isdn";
|
||||||
const char *outbound_rdnis_ton = "unknown";
|
const char *outbound_rdnis_ton = "national";
|
||||||
const char *outbound_rdnis_npi = "unknown";
|
const char *outbound_rdnis_npi = "isdn";
|
||||||
uint32_t span_id = 0;
|
uint32_t span_id = 0;
|
||||||
zap_span_t *span = NULL;
|
zap_span_t *span = NULL;
|
||||||
const char *tonegroup = NULL;
|
const char *tonegroup = NULL;
|
||||||
|
|
|
@ -715,8 +715,7 @@ OZ_DECLARE(int) zap_load_module_assume(const char *name);
|
||||||
OZ_DECLARE(zap_status_t) zap_span_find_by_name(const char *name, zap_span_t **span);
|
OZ_DECLARE(zap_status_t) zap_span_find_by_name(const char *name, zap_span_t **span);
|
||||||
OZ_DECLARE(char *) zap_api_execute(const char *type, const char *cmd);
|
OZ_DECLARE(char *) zap_api_execute(const char *type, const char *cmd);
|
||||||
OZ_DECLARE(int) zap_vasprintf(char **ret, const char *fmt, va_list ap);
|
OZ_DECLARE(int) zap_vasprintf(char **ret, const char *fmt, va_list ap);
|
||||||
|
OZ_DECLARE(zap_status_t) zap_channel_set_caller_data(zap_channel_t *zchan, zap_caller_data_t *caller_data);
|
||||||
OZ_DECLARE(void) zap_set_caller_data(uint32_t span_id, zap_caller_data_t *caller_data);
|
|
||||||
|
|
||||||
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
|
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
|
||||||
ZIO_CODEC_FUNCTION(zio_ulaw2slin);
|
ZIO_CODEC_FUNCTION(zio_ulaw2slin);
|
||||||
|
|
|
@ -176,18 +176,11 @@ static void default_logger(const char *file, const char *func, int line, int lev
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OZ_DECLARE(void) zap_set_caller_data(uint32_t span_id, zap_caller_data_t *caller_data)
|
static zap_status_t zap_set_caller_data(zap_span_t *span, zap_caller_data_t *caller_data)
|
||||||
{
|
{
|
||||||
zap_span_t *span = NULL;
|
if (!caller_data) {
|
||||||
if (!span_id) {
|
zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but no caller_data!\n");
|
||||||
zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but no span id?\n");
|
return ZAP_FAIL;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
zap_span_find(span_id, &span);
|
|
||||||
if (!span) {
|
|
||||||
zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but could not find span\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (caller_data->cid_num.plan == ZAP_NPI_INVALID) {
|
if (caller_data->cid_num.plan == ZAP_NPI_INVALID) {
|
||||||
|
@ -213,6 +206,21 @@ OZ_DECLARE(void) zap_set_caller_data(uint32_t span_id, zap_caller_data_t *caller
|
||||||
if (caller_data->rdnis.type == ZAP_NPI_INVALID) {
|
if (caller_data->rdnis.type == ZAP_NPI_INVALID) {
|
||||||
caller_data->rdnis.type = span->default_caller_data.rdnis.type;
|
caller_data->rdnis.type = span->default_caller_data.rdnis.type;
|
||||||
}
|
}
|
||||||
|
return ZAP_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
OZ_DECLARE(zap_status_t) zap_channel_set_caller_data(zap_channel_t *zchan, zap_caller_data_t *caller_data)
|
||||||
|
{
|
||||||
|
zap_status_t err = ZAP_SUCCESS;
|
||||||
|
if (!zchan) {
|
||||||
|
zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but no zchan!\n");
|
||||||
|
return ZAP_FAIL;
|
||||||
|
}
|
||||||
|
if ((err = zap_set_caller_data(zchan->span, caller_data)) != ZAP_SUCCESS) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
zchan->caller_data = *caller_data;
|
||||||
|
return ZAP_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
OZ_DECLARE_DATA zap_logger_t zap_log = null_logger;
|
OZ_DECLARE_DATA zap_logger_t zap_log = null_logger;
|
||||||
|
@ -1007,9 +1015,8 @@ OZ_DECLARE(zap_status_t) zap_channel_open_any(uint32_t span_id, zap_direction_t
|
||||||
return ZAP_FAIL;
|
return ZAP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
zap_set_caller_data(span_id, caller_data);
|
|
||||||
|
|
||||||
if (span->channel_request && !span->suggest_chan_id) {
|
if (span->channel_request && !span->suggest_chan_id) {
|
||||||
|
zap_set_caller_data(span, caller_data);
|
||||||
return span->channel_request(span, 0, direction, caller_data, zchan);
|
return span->channel_request(span, 0, direction, caller_data, zchan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1056,6 +1063,7 @@ OZ_DECLARE(zap_status_t) zap_channel_open_any(uint32_t span_id, zap_direction_t
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (span && span->channel_request) {
|
if (span && span->channel_request) {
|
||||||
|
zap_set_caller_data(span, caller_data);
|
||||||
status = span->channel_request(span, i, direction, caller_data, zchan);
|
status = span->channel_request(span, i, direction, caller_data, zchan);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue