if (chan_id) {
status = zap_channel_open(span_id, chan_id, &zchan);
- zap_set_caller_data(span_id, &caller_data);
} else {
status = zap_channel_open_any(span_id, direction, &caller_data, &zchan);
}
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_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);
switch_channel_set_caller_profile(channel, caller_profile);
tech_pvt->caller_profile = caller_profile;
zap_status_t zstatus = ZAP_FAIL;
const char *context = "default";
const char *dialplan = "XML";
- const char *outbound_called_ton = "unknown";
- const char *outbound_called_npi = "unknown";
- const char *outbound_calling_ton = "unknown";
- const char *outbound_calling_npi = "unknown";
- const char *outbound_rdnis_ton = "unknown";
- const char *outbound_rdnis_npi = "unknown";
+ const char *outbound_called_ton = "national";
+ const char *outbound_called_npi = "isdn";
+ const char *outbound_calling_ton = "national";
+ const char *outbound_calling_npi = "isdn";
+ const char *outbound_rdnis_ton = "national";
+ const char *outbound_rdnis_npi = "isdn";
uint32_t span_id = 0;
zap_span_t *span = NULL;
const char *tonegroup = NULL;
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(int) zap_vasprintf(char **ret, const char *fmt, va_list ap);
-
-OZ_DECLARE(void) zap_set_caller_data(uint32_t span_id, zap_caller_data_t *caller_data);
+OZ_DECLARE(zap_status_t) zap_channel_set_caller_data(zap_channel_t *zchan, zap_caller_data_t *caller_data);
ZIO_CODEC_FUNCTION(zio_slin2ulaw);
ZIO_CODEC_FUNCTION(zio_ulaw2slin);
}
-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 (!span_id) {
- zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but no span id?\n");
- 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) {
+ zap_log(ZAP_LOG_CRIT, "Error: trying to set caller data, but no caller_data!\n");
+ return ZAP_FAIL;
}
if (caller_data->cid_num.plan == ZAP_NPI_INVALID) {
if (caller_data->rdnis.type == ZAP_NPI_INVALID) {
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;
return ZAP_FAIL;
}
- zap_set_caller_data(span_id, caller_data);
-
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);
}
) {
if (span && span->channel_request) {
+ zap_set_caller_data(span, caller_data);
status = span->channel_request(span, i, direction, caller_data, zchan);
break;
}