]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
per channel callerid
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Jun 2008 18:24:35 +0000 (18:24 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 6 Jun 2008 18:24:35 +0000 (18:24 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8784 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr_originate.c

index f9bf41060bb6233c7ac957517c03b7ab8d6f522e..bbf6c41276b85aa1037d4599d2f3c3500852a381 100644 (file)
@@ -729,8 +729,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                for (r = 0; r < or_argc; r++) {
                        uint32_t hups;
-                       char *p,*e = NULL;
-
+                       char *p, *e = NULL;
+                       const char *var_begin, *var_end;
+                       
                        reason = SWITCH_CAUSE_UNALLOCATED;
                        memset(peer_names, 0, sizeof(peer_names));
                        peer_session = NULL;
@@ -859,6 +860,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                                myflags |= SOF_FORKED_DIAL;
                                        }
                                }
+
+                               if (vdata && (var_begin = switch_stristr("effective_caller_id_number=", vdata))) {
+                                       char tmp[512] = "";
+                                       var_begin += strlen("effective_caller_id_number=");
+                                       var_end = strchr(var_begin, '|');
+                                       if (var_end) {
+                                               strncpy(tmp, var_begin, var_end-var_begin);
+                                       } else {
+                                               strncpy(tmp, var_begin, strlen(var_begin));
+                                       }
+                                       new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
+                               }
+
+                               if (vdata && (var_begin = switch_stristr("effective_caller_id_name=", vdata))) {
+                                       char tmp[512] = "";
+                                       var_begin += strlen("effective_caller_id_name=");
+                                       var_end = strchr(var_begin, '|');
+                                       if (var_end) {
+                                               strncpy(tmp, var_begin, var_end-var_begin);
+                                       } else {
+                                               strncpy(tmp, var_begin, strlen(var_begin));
+                                       }
+                                       new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
+                               }
+
                                if ((reason =
                                         switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
                                                                                                                  myflags)) != SWITCH_CAUSE_SUCCESS) {