allow span name in dial string instead of span number openzap/<span_name>/A|<num>

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@584 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2008-10-06 15:57:11 +00:00
parent 11ee8f645b
commit 7f960f6edb
1 changed files with 16 additions and 1 deletions

View File

@ -882,6 +882,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
zap_status_t status;
int direction = ZAP_TOP_DOWN;
zap_caller_data_t caller_data = {{ 0 }};
char *span_name = NULL;
if (!outbound_profile) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing caller profile\n");
@ -894,8 +895,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
dest = outbound_profile->destination_number;
span_id = atoi(dest);
if (switch_is_number(dest)) {
span_id = atoi(dest);
} else {
span_name = dest;
}
if ((p = strchr(dest, '/'))) {
if (*p++) {
if (*p == 'A') {
@ -911,6 +918,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
}
}
if (!span_id && !switch_strlen_zero(span_name)) {
zap_span_t *span;
zap_status_t zstatus = zap_span_find_by_name(span_name, &span);
if (zstatus == ZAP_SUCCESS && span) {
span_id = span->span_id;
}
}
if (!span_id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing span\n");
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;