]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
allow span name in dial string instead of span number openzap/<span_name>/A|<num>
authorMichael Jerris <mike@jerris.com>
Mon, 6 Oct 2008 15:57:11 +0000 (15:57 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 6 Oct 2008 15:57:11 +0000 (15:57 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@584 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c

index 1fa56ea3934c8c1baffca4e1902a99eb2e025a8b..77f9a79ee0106e88e789bf64b35dc20656051e8d 100644 (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;