]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add CALL_UPDATE event
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Oct 2009 16:52:55 +0000 (16:52 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Oct 2009 16:52:55 +0000 (16:52 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15119 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/src/esl_event.c
libs/esl/src/include/esl_event.h
src/include/switch_types.h
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/sofia.c
src/switch_channel.c
src/switch_event.c

index e2f6359b53a8613aa819b5e9808c0939674756f8..0fe49301a66ac892746edcd667d6208b5d60a1ab 100644 (file)
@@ -128,6 +128,7 @@ static const char *EVENT_NAMES[] = {
        "NAT",
        "RECORD_START",
        "RECORD_STOP",
+       "CALL_UPDATE",
        "ALL"
 };
 
index 14c21a5967f378fd3efba9c46006b0ed7473394b..d4bfcede4700e46a85668b2ec627f5dc3f950010 100644 (file)
@@ -116,6 +116,7 @@ typedef enum {
        ESL_EVENT_NAT,
        ESL_EVENT_RECORD_START,
        ESL_EVENT_RECORD_STOP,
+       ESL_EVENT_CALL_UPDATE,
        ESL_EVENT_ALL
 } esl_event_types_t;
 
index acee75bb92f9dbe094ff1af3609d6d4219d79e96..539e8dfe7d3effe2abd5c02ccd9fe8c3fef6f13f 100644 (file)
@@ -1290,6 +1290,7 @@ typedef enum {
        SWITCH_EVENT_NAT,
        SWITCH_EVENT_RECORD_START,
        SWITCH_EVENT_RECORD_STOP,
+       SWITCH_EVENT_CALL_UPDATE,
        SWITCH_EVENT_ALL
 } switch_event_types_t;
 
index 483d627f958a851d7f11f6d32d4ab20576d502ca..16f9729d34ac245e728f72044b105327de593117 100644 (file)
@@ -1284,6 +1284,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                        if (!switch_strlen_zero(name)) {
                                char message[256] = "";
                                const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
+                               switch_event_t *event;
 
                                if (switch_strlen_zero(number)) {
                                        number = tech_pvt->caller_profile->destination_number;
@@ -1303,6 +1304,22 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                           TAG_END());
                                }
 
+
+                               
+                               if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
+                                       const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND");
+                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
+                                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
+                                       if (uuid) {
+                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
+                                       }
+                                       switch_channel_event_set_data(channel, event);
+                                       switch_event_fire(&event);
+                               }
+
+
+
                        }
 
                        switch_safe_free(arg);
index 4008cbeea8b7bd8f24bf955850deb4975a2a4d84..cdd7698c2215808576c9e85636b65cd42b54df83 100644 (file)
@@ -420,6 +420,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
        const char *number = "unknown", *tmp;
        switch_caller_profile_t *caller_profile;
        char *dup = NULL;
+       switch_event_t *event;
 
        if (sip->sip_to) {
                number = sip->sip_to->a_url->url_user;
@@ -450,6 +451,18 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
                number = tmp;
        }
 
+       if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
+               const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
+               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
+               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
+               if (uuid) {
+                       switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
+               }
+               switch_channel_event_set_data(channel, event);
+               switch_event_fire(&event);
+       }
+       
        caller_profile = switch_channel_get_caller_profile(channel);
        caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, name);
        caller_profile->callee_id_number = switch_core_strdup(caller_profile->pool, number);
@@ -5673,6 +5686,7 @@ void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t
                                                   TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
                                                   TAG_END());
                        }
+
                }
        }
 }
index 707cec5fbad680b56d458e2a8173621bbf4e7ccc..fe7b02e1cef0dc38eb992c17ec839090fdf4217d 100644 (file)
@@ -1408,6 +1408,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
                event->event_id == SWITCH_EVENT_API ||
                event->event_id == SWITCH_EVENT_RECORD_START ||
                event->event_id == SWITCH_EVENT_RECORD_STOP ||
+               event->event_id == SWITCH_EVENT_CALL_UPDATE ||
                event->event_id == SWITCH_EVENT_CUSTOM
                ) {
 
index 9bc81d9a1dc9de159e2b5d44678225a46b536cc8..3b8b3d83a99ee53074e4874ef44561b933f5d475 100644 (file)
@@ -182,6 +182,7 @@ static char *EVENT_NAMES[] = {
        "NAT",
        "RECORD_START",
        "RECORD_STOP",
+       "CALL_UPDATE"
        "ALL"
 };