From 5ffcb8acdfbc98a3722a1e7429a2a5965a98ce35 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 22 Nov 2011 08:46:13 -0600 Subject: [PATCH 1/9] FS-3713 --resolve --- src/mod/timers/mod_timerfd/mod_timerfd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/timers/mod_timerfd/mod_timerfd.c b/src/mod/timers/mod_timerfd/mod_timerfd.c index 9831b405d2..f647f4b49f 100644 --- a/src/mod/timers/mod_timerfd/mod_timerfd.c +++ b/src/mod/timers/mod_timerfd/mod_timerfd.c @@ -31,7 +31,12 @@ */ #include +#ifdef TIMERFD_WRAP +#define TFD_CLOEXEC 0 +#include +#else #include +#endif #include SWITCH_MODULE_LOAD_FUNCTION(mod_timerfd_load); From 51fe96281cf777c626d3d05a244b3e76f66b86eb Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Tue, 22 Nov 2011 16:10:21 -0600 Subject: [PATCH 2/9] FS-3676 --resolve mod_lcr - convert assert to log and fix check condition --- src/mod/applications/mod_lcr/mod_lcr.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 41c9d0f85b..3c5062ed6f 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -626,6 +626,8 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa if (!argv[i] || zstr(argv[i])) { /* maybe we want to consider saying which carriers have null rate fields... maybe they can run the query and find out */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rate field is null, skipping\n"); + /* kill prev/next pointers */ + /* additional->prev = NULL; */ goto end; } additional->rate = (float)atof(switch_str_nil(argv[i])); @@ -750,8 +752,16 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa /* lcr was not added to any lists, so destroy lcr object here */ if (lcr_skipped == SWITCH_TRUE) { - /* ensure we didn't accidentally add additional to the list */ - switch_assert(additional->prev == NULL && current->next != additional); + /* complain loudly if we're asked to destroy a route that is + added to the route list */ + if (additional && additional->prev != NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "additional->prev != NULL\n"); + } + if (current && current->next == additional) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "current->next == additional\n"); + } lcr_destroy(additional); } From 092c232814f3c9404ab31f1d842a3bc084e95e89 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 22 Nov 2011 15:48:29 -0800 Subject: [PATCH 3/9] Update ChangeLog through Oct 31; update phrase_en.xml --- docs/ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++ docs/phrase/phrase_en.xml | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index f650782dc2..78d8f84d85 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -30,6 +30,7 @@ freeswitch (1.0.7) build: They no longer ship the wsj model in pocketsphinx... and seems the dictionary has moved a bit. (r:23571680) build: unimrcp vs2010 build fixes for new version (r:2dcca5f4) build: add sqlite to clean on make current or update-clean (r:2366f429) + build: Update windows to use Lame 3.98.4 (r:4349ec00) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -328,6 +329,13 @@ freeswitch (1.0.7) core: prevent sql injection by using sqlite formatter on various code that generates sql stmts with switch_snprintf (r:256a6264) core: add ivr_menu_terminator variable you can set to none or the dtmf chars you want to terminate input (r:0a3e5d2f) core: delay_echo was double the length in milliseconds from what it should be (r:3317f5d3) + core: fix issue where clearing a single realm does not completely clear (r:d2710422) + core: add manual_rtp_bug gen_one_gen_all to prevent rtp passthru to break the *S* word.. (r:9e094835) + core: Add transfer_history to logs (r:1bf97fa7) + core: add fsctl sync_clock_when_idle so you can sync the clock but have it not do it till there are 0 calls (r:2094f2d3) + core: add getGlobalVariable and setGlobalVariable to swig stuff (r:2faaee0e) + core: Fix erroneous "module busy" messages on module unload (r:bad5964b/FS-3589) + core: move code from uuid_kill into core (r:3c9551ee) docs: Major clean up of doxygen generated core API documentation (r:794246e1) docs: Add libteletone back to core API documentation (r:c35c138d) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) @@ -341,6 +349,8 @@ freeswitch (1.0.7) fs_cli: add timeout option to fs_cli (r:5fad26b4) fs_cli: implement CLI prompt redrawing (r:a79f1f42) (many other minor changes by TC on 2011-09-22) fs_cli: implement configurable prompt, input, and output coloring (r:c7ec19d6) + fs_cli: allow ;; seperated commands in fs_cli -x (r:cbc92936) + fs_cli: only enable new features on supported terminals (r:26cd927c) lang: Improve French phrase files (FSCONFIG-23) lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) (r:c81a9448/FS-2937) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) @@ -348,6 +358,7 @@ freeswitch (1.0.7) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) libdingaling: fix crash when GV call ends (r:687140b5/FS-3139) libdingaling: fix small leak (r:d3ea42d8/FS-3334) + libdingaling: send keep alive packets to prevent NAT from munging connection (thanks Federico Beffa) (r:4bd305e5/FS-3612) libesl: Fix potential race condition (ESL-36) libesl: Add /uuid command to fs_cli to filter logs by uuid libesl: Increase buffer in fs_cli for Win (r:d1d6be88/FSCORE-611) @@ -386,6 +397,7 @@ freeswitch (1.0.7) libfreetdm: receive side, update libteletone to track duration so it is less likely to double detect and push api changes down to freetdm (r:a65794fb/FS-3570) libg7221: A bunch of tweaks to the G.722.1 codec (r:5d548570) libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248) + libiksemel: making this the new default and patching libdingaling to use it exclusively with openssl, now we actually have single thread for gtalk an no gah noodlez (r:f506e19e/FS-3471) libjs: non-portable comment syntax in .s files libldns: select on FD > 1024 get this patch to ldns ppl (r:710fc7a7/FS-3110) libopenzap: Add CLI tracing @@ -429,6 +441,7 @@ freeswitch (1.0.7) mod_blacklist: Add example configuration file (r:d00f7464) mod_blacklist: Resource leak fixes, config checks and add help output for api interface (r:41abb3e6) mod_blacklist: add ability to dump a list back to it's text file (r:1d5f5ec7) + mod_blacklist: fix broken dump/save (r:abc5d7cd/FS-3617) mod_callcenter: Initial commit of the mod_callcenter application. This module is in it early state of developpement. You can see documentation on the wiki at : http://wiki.freeswitch.org/wiki/Mod_callcenter For support/comments, please use http://jira.freeswitch.org/ and select the MOD CALLCENTER module. (r:ba09b96d) mod_callcenter: Add ability to unload/reload/load a queue setting (You still need to reloadxml before). Note that joining a queue will check for it in the config and load it on the fly... I've used the same system as in mod_voicemail. Not sure if we should allow this, but just comment it out of the config before unload and it wont be available anymore (r:3eafca60) mod_callcenter: Try to fix the ring-all, also add cli auto complete done in previous commit (r:1666783c) @@ -545,6 +558,10 @@ freeswitch (1.0.7) mod_conference: add conference member flag nomoh (r:f35a6814) mod_conference: add hup command to conference (kick without the kick sound) (r:492db906) mod_conference: see H.264 iFrames (r:765be8c9/FS-3406) + mod_conference: add moderator PIN controls (thanks Moy) (r:1936c2b0/FS-3493) + mod_conference: remove waste flags from both conference and member and explicitly always send audio from conferences to avoid random interop issues and general discomfort these flags are now deprecated (r:5d77e789) + mod_conference: add conference cdrs to mod_conference (r:127be02d) + mod_conference: add custom kick sound to conference (r:8fde25cc) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -557,6 +574,8 @@ freeswitch (1.0.7) mod_dingaling: fix mod_dingaling/iksemel/gnutls link error when using newer autotools (r:294b0779/FS-3182) mod_dingaling: fix segmentation fault on mod_dingaling when receiving a discovery from the server (r:2e651c8f/FS-3391) mod_dingaling: Remove unused but set variables GCC-4.6 -Wunused-but-set-variable (r:0f45b8ba/GCC-4) + mod_dingaling: Add from_jid (r:f0b52ef7/FS-3611) + mod_dingaling: autoflush durning bridge in dingaling (r:bd9317f2) mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" (r:163ca31f) mod_directory: let mod_directory use non-XML dialplans (r:8895de1b) mod_distributor: Add mod_distributor to VS2010 - not built by default (r:bac79ba1) @@ -606,6 +625,7 @@ freeswitch (1.0.7) mod_event_socket: (and mod_erlang_event) make empty apply-inbound-acl config line not deny all (r:8ae9ab5d/FS-3034) mod_event_socket: allow duplicate headers to be parsed into events received on the wire (r:2b7a830d) mod_event_socket: add optional format string after myevent (r:7ed7f539) + mod_event_socket: Allow ridiculously long commands over event socket (r:6bbde4e2/FS-3621) mod_event_zmq: Intitial mod_event_zmq code (r:4d554067) mod_event_zmq: Update download file from 2.1.3 to 2.1.4 (2.1.3 tar file is gone from zmq server) (r:0b780702) mod_event_zmq: Bump to zeromq-2.1.9 (r:3a352e67) @@ -625,6 +645,7 @@ freeswitch (1.0.7) mod_fifo: Fix URI (r:26039c57/FS-3548) mod_fifo: add _continue_ value for fifo orbit exten that just means exit back to the next dp instruction (r:4d6ee827) mod_file_string: Fix segfault when using file string in conference (r:9c40e8e9/FS-3122) + mod_flite: Update to flite 1.5.1 it should sound better now too (r:ecbd1db8) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -688,6 +709,7 @@ freeswitch (1.0.7) mod_h323: set network_addr of caller profile to signaling ip address. (requested by Steven Ayre) (r:072bf5ad) mod_h323: fix race condition on destroying signaling thread in h323 library (r:c22aac0e) mod_h323: move the switch_rtp_request_port() call from the contructor to FSH323Connection::CreateRealTimeLogicalChannel() - fix rtp port leak. tnx to Peter Olsson. (r:6f4c4ea0) + mod_http_cache: Initial commit of new module (thanks crienzo) (r:c51acfcc/FS-3597) mod_java: fix eventConsumer issue and add flush() method (r:7fd3aff6) mod_java: Allow user defined java methods to be called at startup and shutdown of JVM (r:1339e218/MODLANG-117) mod_json_cdr: Fix segfault in mod_json_cdr.c (r:f347698a/MODEVENT-66) @@ -728,6 +750,7 @@ freeswitch (1.0.7) mod_managed: add additional support (r:5be58aac) mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774) mod_managed: resolve Memory leak in mod_managed by EventBinding and swig delete_switch_event (r:c6048134/FS-3381) + mod_managed: upgrade mono to support 2.8 - MichaelGG (r:1dcac642/FS-2774) mod_mongo: New mod, initial commit; module for MongoDB (http://www.mongodb.org/) (r:dc6ca6f8/FS-3278) mod_mongo: add mapreduce API (r:7c5b5797/FS-3357) mod_mp4v: MP4V-ES passthru for washibechi on IRC @@ -747,6 +770,7 @@ freeswitch (1.0.7) mod_opus: Use libtool archives for linking, add dependencies to fix parallel builds (r:74bbd4be) mod_osp: initial check (Open Settlement Protocol) mod_osp:Changed OSP TCP port from 1080 to 5045. (r:03abefdf) + mod_perl: add chat app to perl (r:18897f9e) mod_pocketsphinx: Update PocketSphinx to the latest builds... only had to make two changes (r:1a39d7fb) mod_pocketsphinx: They no longer ship the wsj model in pocketsphinx... and seems the dictionary has moved a bit. (r:23571680) mod_portaudio: Fix inbound state (CS_ROUTING not CS_INIT) (MODENDP-302) @@ -757,6 +781,7 @@ freeswitch (1.0.7) mod_portaudio: Fix Windows crash (r:94c9cbf6/FS-3498) mod_portaudio_stream: update to specify the channel index (r:d1169d6e) mod_protovm: This is a very early new prototype voicemail ivr system. You need to copy the sounds.xml and make it loadale in the language folder and protovm.conf.xml inside the autoload_configs folder. Configs file will most definitly change. Once stabilized, we make it install those file by default. (r:fb549777) + mod_python: add chat app to python (r:08917021) mod_radius_cdr: Add 'Freeswitch-Direction' av pair (r:a5170df0) mod_radius_cdr: Add 'Freeswitch-Other-Leg-Id' av pair (r:18d29b46) mod_radius_cdr: log errors with the call's uuid (r:fee49b16) @@ -774,6 +799,7 @@ freeswitch (1.0.7) mod_rtmp: remove superfluous hangup (r:50817655) mod_rtmp: fix crash when call made from user not in domain (r:a5452174/FS-3353) mod_rtmp: add params so xml curl can know who's calling the directory request (r:91b73d1f) + mod_rtmp: New feature: param disallow-multiple-registration on user directory logs out all other users on other sessions with the same user:domain pair. (r:624a2921) mod_sangoma_codec: Add sample config file mod_sangoma_codec: added load/noload options for the supported codecs mod_sangoma_codec: rename load/noload to register/noregister @@ -1058,7 +1084,17 @@ freeswitch (1.0.7) mod_sofia: save telephony event data for recovery (r:4d1a76ee) mod_sofia: tighten up the parsing of these boolean vals issue in t38 sdp (r:626b5cb2/FS-3571,FS-3442,FS-957) mod_sofia: resolve race condition caused by unresponsive host when unregistering the gateway. (r:607c112f/FS-3583) + mod_sofia: only require user and pass in gateway when register is true (r:9e4ca2c2) + mod_sofia: Remove arbitrary 100 ACL limit (r:dd5188f3/FS-3605) + mod_sofia: add t38_pass_broken_boolean to pass the broken boolean behaviour over to the other side of the call when detected (r:afd0e1fc) + mod_sofia: Update handling of sub/notify (fixes broken Snom BLF) (r:51c22811/FS-2877) + mod_sofia: Don't add Contact header to MESSAGE requests, per RFC3428 (libsofia still does it a bit) (r:1f6670e7/FS-3628) + mod_sofia: add presence_map (r:4ee1722f) + mod_sofia: add presence_map config (r:48416707) + mod_sofia: add lookup params to presence_map (r:ea7f6a18) + mod_sofia: add missing mod_sofia indexes (r:40df8d65) mod_soundtouch: updated soundtouch to library 1.5.0 to fix gcc > 4.3 incompatibilities (r:dfb5c629) + mod_soundtouch: Update soundtouch to 1.6.0 to fix FS-3634 (r:d8ae59fd/FS-3634) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -1081,6 +1117,8 @@ freeswitch (1.0.7) mod_spandsp: add more fax event information (r:0555b702/FS-3345) mod_spandsp: fix memory issue in spandsp_tone_detect (r:8793c2ed) mod_spandsp: Tweak link order of some libs to fix build on gcc platforms that have ld flag "--as-needed" as default. (r:0db88b59/FS-2873/FS-2874) + mod_spandsp: Fix spandsp_start_fax_detect timeout issue (r:90a6e78d/FS-3619) + mod_spandsp: Add tone_type param to start_fax_detect to handle outbound fax detection (r:d6d18748/FS-3624) mod_spidermonkey: allow vars to be set containing vars from languages (r:5cd072a3) mod_spidermonkey: fix seg in js hangup (r:7d554c11) mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) @@ -1102,6 +1140,9 @@ freeswitch (1.0.7) mod_valet_parking: add valet_announce_slot variable (r:293d7254) mod_valet_parking: make valet parking reserve a space for 10 seconds to allow time for an attended transfer switcharoo (r:308f44af) mod_valet_parking: refactor timeout tracker for valet (r:3514c780) + mod_valet_parking: valet_info now returns uuid properly (r:34ddeb75/FS-3613) + mod_valet_parking: add presence to mod_valet_parking subscribe to the lot name for general stats or individual slots to monitor with park+ prefix *note* this used to be used in mod_fifo which now will use queue+ going forward (r:9daa42c1) + mod_valet_parking: lower token freq to 5, put it in a define and have more obvious warning about full lots (r:2f786a07) mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) @@ -1125,12 +1166,14 @@ freeswitch (1.0.7) mod_voicemail: add message_len to output of vm_list api command (r:77c5000d) mod_voicemail: use vm_email as notification address if vm_notify_email isn't set (that behavior was in voicemail_leave_main but not in deliver_vm) (r:8974f9d6) mod_voicemail: better fix for voicemail email key match (r:aff4bcbe/FS-3080) + mod_voicemail: Prevent rewind key from breaking out of message playback (r:923a104b/FS-3637) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) mod_xml_cdr: Fix prefix-a-leg not respected for url submission (r:ea9021a2/FS-2998) mod_xml_cdr: Fix delay to 5 sec from 5000 sec (r:34a38009/FS-2815) + mod_xml_cdr: Accept all 2xx messages, not just "200" (r:d39b7c6b/FS-3593) mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) scripts: do simple verification to make sure we are getting IP addresses from VoIP abuse blacklist (r:b0049160) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index ecdebc9fdf..58d5a3604f 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -493,7 +493,7 @@ - + From dc9bf68301118b0e70ab707d2543bbcd96709196 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 22 Nov 2011 17:59:04 -0600 Subject: [PATCH 4/9] FS-3714 --resolve You are using the sip_from_host and sip_to_host which are calculated based on the response from the other end, this patch will pre-populate the variables with what it is suspeceted to be in these values but they are not guranteed to be right if there was forwarding etc and also it will not always be an ip if you send to foo@domain.com the sip_to_host will be domain.com until it replies. This is the best you will get.... --- src/mod/endpoints/mod_sofia/mod_sofia.h | 2 +- src/mod/endpoints/mod_sofia/sofia_glue.c | 28 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index b13d9ffd35..4a74ce3735 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1139,4 +1139,4 @@ void sofia_glue_parse_rtp_bugs(switch_rtp_bug_flag_t *flag_pole, const char *str char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_dispatch_event_t *de, sofia_nat_parse_t *np); void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); void sofia_process_dispatch_event(sofia_dispatch_event_t **dep); - +char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 15eb3a1976..1585fd89fd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2240,6 +2240,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } switch_channel_set_variable(channel, "sip_req_uri", s); } + + switch_channel_set_variable(channel, "sip_to_host", sofia_glue_get_host(to_str, switch_core_session_get_pool(session))); + switch_channel_set_variable(channel, "sip_from_host", sofia_glue_get_host(from_str, switch_core_session_get_pool(session))); if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, NUTAG_URL(url_str), @@ -6785,6 +6788,31 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof return contact_str; } +char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool) +{ + char *s, *p; + + if ((p = strchr(str, '@'))) { + p++; + } else { + return NULL; + } + + if (pool) { + s = switch_core_strdup(pool, p); + } else { + s = strdup(p); + } + + for (p = s; p && *p; p++) { + if ((*p == ';') || (*p == '>')) { + *p = '\0'; + break; + } + } + + return s; +} /* For Emacs: From 58c3c3a049991fedd39f62008f8eb8fca047e7c5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 22 Nov 2011 18:22:57 -0600 Subject: [PATCH 5/9] comment out optional Require header from re-invites for the sake of interop with testy t.38 terminals --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c | 15 +++++++-------- src/mod/endpoints/mod_sofia/mod_sofia.c | 1 + 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 79031274b7..9101269125 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Nov 2 08:58:40 CDT 2011 +Tue Nov 22 18:16:53 CST 2011 diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index bc80310f23..1958b5645a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -4486,14 +4486,13 @@ session_timer_add_headers(struct session_timer *t, return 1; sip_add_tl(msg, sip, - TAG_IF(expires != 0, SIPTAG_SESSION_EXPIRES(x)), - TAG_IF(min != 0 - /* Min-SE: 0 is optional with initial INVITE */ - || !initial, - SIPTAG_MIN_SE(min_se)), - TAG_IF(refresher == nua_remote_refresher && expires != 0, - SIPTAG_REQUIRE_STR("timer")), - TAG_END()); + TAG_IF(expires != 0, SIPTAG_SESSION_EXPIRES(x)), + TAG_IF(min != 0 + /* Min-SE: 0 is optional with initial INVITE */ + || !initial, + SIPTAG_MIN_SE(min_se)), + //TAG_IF(refresher == nua_remote_refresher && expires != 0, SIPTAG_REQUIRE_STR("timer")), + TAG_END()); return 1; } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7d37776f69..f416c0fff0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5412,3 +5412,4 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown) * For VIM: * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ + From 4dbc9d7cbcb50ef72a65fa71268448b311b45ce4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 Nov 2011 10:33:51 -0600 Subject: [PATCH 6/9] FS-3688 I think 100'th time's the charm..... --- src/mod/endpoints/mod_sofia/sofia.c | 8 ++++-- src/mod/endpoints/mod_sofia/sofia_glue.c | 31 ++++++++++++------------ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9bba10ff31..3efd02cd8f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5790,8 +5790,12 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, goto done; } - if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { - sofia_glue_tech_proxy_remote_addr(tech_pvt, r_sdp); + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { + if (sofia_glue_tech_proxy_remote_addr(tech_pvt, r_sdp) == SWITCH_STATUS_SUCCESS) { + nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio params changed, NOT proxying re-invite.\n"); + goto done; + } } msg = switch_core_session_alloc(other_session, sizeof(*msg)); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 1585fd89fd..41048a1d84 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1383,13 +1383,14 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL, *pe; int x; const char *val; - + switch_status_t status = SWITCH_STATUS_FALSE; + if (zstr(sdp_str)) { sdp_str = tech_pvt->remote_sdp_str; } if (zstr(sdp_str)) { - return SWITCH_STATUS_FALSE; + goto end; } if ((p = (char *) switch_stristr("c=IN IP4 ", sdp_str)) || (p = (char *) switch_stristr("c=IN IP6 ", sdp_str))) { @@ -1409,7 +1410,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co } if (!(ip_ptr && port_ptr)) { - return SWITCH_STATUS_FALSE; + goto end; } p = ip_ptr; @@ -1419,7 +1420,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co rip[x++] = *p; p++; if (p >= pe) { - return SWITCH_STATUS_FALSE; + goto end; } } @@ -1429,7 +1430,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co rp[x++] = *p; p++; if (p >= pe) { - return SWITCH_STATUS_FALSE; + goto end; } } @@ -1439,13 +1440,13 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co rvp[x++] = *p; p++; if (p >= pe) { - return SWITCH_STATUS_FALSE; + goto end; } } if (!(*rip && *rp)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "invalid SDP\n"); - return SWITCH_STATUS_FALSE; + goto end; } tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, rip); @@ -1500,7 +1501,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n", tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port); - return SWITCH_STATUS_SUCCESS; + switch_goto_status(SWITCH_STATUS_BREAK, end); } if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"))) { @@ -1511,6 +1512,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, remote_rtcp_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err); + status = SWITCH_STATUS_GENERR; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n", tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port); @@ -1522,10 +1524,13 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt, co if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) { tech_pvt->check_frames = 0; } + status = SWITCH_STATUS_SUCCESS; } } - return SWITCH_STATUS_SUCCESS; + end: + + return status; } @@ -3174,9 +3179,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f } if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) { - if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL)) != SWITCH_STATUS_SUCCESS) { - goto end; - } + sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL); if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && !((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) { @@ -3497,9 +3500,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f } if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) { - if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL)) != SWITCH_STATUS_SUCCESS) { - goto end; - } + sofia_glue_tech_proxy_remote_addr(tech_pvt, NULL); if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && !((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) { From 4ab5fd14b3d7fdd53e4186ba3d530657e702bc91 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 Nov 2011 11:00:00 -0600 Subject: [PATCH 7/9] fix regex parsing in dmachine --- src/switch_ivr_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 9f99627827..a43cadf72f 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -306,6 +306,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin for(bp = dmachine->realm->binding_list; bp; bp = bp->next) { if (bp->is_regex) { switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits); + pmatches = 1; if (r_status == SWITCH_STATUS_SUCCESS) { if (is_timeout) { @@ -313,7 +314,6 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin exact_bp = bp; break; } - pmatches = 1; best = DM_MATCH_PARTIAL; } } else { From 35112f2269ba57378394723505bf07488362d312 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 23 Nov 2011 13:25:24 -0600 Subject: [PATCH 8/9] FS-3586 --resolve --- conf/sip_profiles/internal.xml | 2 +- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 1ccc54e445..7f688b2472 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -73,7 +73,7 @@ - + diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 9aa31ae1ba..dfd4677ebe 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1436,7 +1436,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } /* Log line added to support Fail2Ban */ if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "SIP auth challenge (%s) on sofia profile '%s' " + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth challenge (%s) on sofia profile '%s' " "for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER", profile->name, to_user, to_host, network_ip); } From b9e28f85cb35db7dd72b6760310fa3ad18e5aa2d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 23 Nov 2011 15:38:54 -0600 Subject: [PATCH 9/9] add send_info dp app and uuid_send_info FSAPI and execute_on_sip_extra_headers and api_on_sip_extra_headers handler variables --- src/include/switch_types.h | 1 + .../applications/mod_commands/mod_commands.c | 40 +++++++++++++++++++ .../applications/mod_dptools/mod_dptools.c | 14 +++++++ src/mod/endpoints/mod_sofia/mod_sofia.c | 22 +++++++++- src/mod/endpoints/mod_sofia/mod_sofia.h | 4 +- src/mod/endpoints/mod_sofia/sofia.c | 37 +++++++++++++++-- src/mod/endpoints/mod_sofia/sofia_glue.c | 12 +++++- 7 files changed, 123 insertions(+), 7 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 79d45c11b4..b35c73c567 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -871,6 +871,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH, SWITCH_MESSAGE_INDICATE_SIGNAL_DATA, + SWITCH_MESSAGE_INDICATE_INFO, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 1f4984aa19..cffe756ad2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3022,6 +3022,44 @@ SWITCH_STANDARD_API(uuid_phone_event_function) return SWITCH_STATUS_SUCCESS; } +#define INFO_SYNTAX "" +SWITCH_STANDARD_API(uuid_send_info_function) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + char *mycmd = NULL, *argv[2] = { 0 }; + int argc = 0; + + if (!zstr(cmd) && (mycmd = strdup(cmd))) { + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argc < 1) { + stream->write_function(stream, "-USAGE: %s\n", INFO_SYNTAX); + } else { + switch_core_session_message_t msg = { 0 }; + switch_core_session_t *lsession = NULL; + + msg.message_id = SWITCH_MESSAGE_INDICATE_INFO; + msg.string_array_arg[2] = argv[1]; + msg.from = __FILE__; + + if ((lsession = switch_core_session_locate(argv[0]))) { + status = switch_core_session_receive_message(lsession, &msg); + switch_core_session_rwunlock(lsession); + } + } + + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Success\n"); + } else { + stream->write_function(stream, "-ERR Operation Failed\n"); + } + + switch_safe_free(mycmd); + + return SWITCH_STATUS_SUCCESS; +} + #define DEBUG_AUDIO_SYNTAX " " SWITCH_STANDARD_API(uuid_debug_audio_function) @@ -5344,6 +5382,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_send_info", "Send info to the endpoint", uuid_send_info_function, INFO_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_outgoing_answer", "Answer Outgoing Channel", outgoing_answer_function, OUTGOING_ANSWER_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_limit", "Increase limit resource", uuid_limit_function, LIMIT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_limit_release", "Release limit resource", uuid_limit_release_function, LIMIT_RELEASE_SYNTAX); @@ -5470,6 +5509,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_getvar ::console::list_uuid"); switch_console_set_complete("add uuid_hold ::console::list_uuid"); + switch_console_set_complete("add uuid_send_info ::console::list_uuid"); switch_console_set_complete("add uuid_jitterbuffer ::console::list_uuid"); switch_console_set_complete("add uuid_kill ::console::list_uuid"); switch_console_set_complete("add uuid_outgoing_answer ::console::list_uuid"); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 09299d8f2e..ebe51c3a28 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1154,6 +1154,19 @@ SWITCH_STANDARD_APP(redirect_function) switch_core_session_receive_message(session, &msg); } +SWITCH_STANDARD_APP(send_info_function) +{ + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to send info */ + msg.from = __FILE__; + msg.string_arg = data; + msg.message_id = SWITCH_MESSAGE_INDICATE_INFO; + msg.string_array_arg[2] = data; + + switch_core_session_receive_message(session, &msg); +} + SWITCH_STANDARD_APP(jitterbuffer_function) { switch_core_session_message_t msg = { 0 }; @@ -4050,6 +4063,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "send_info", "Send info", "Send info", send_info_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", jitterbuffer_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "", diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f416c0fff0..2f9958a335 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1906,7 +1906,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi case SWITCH_MESSAGE_INDICATE_PHONE_EVENT: { const char *event = "talk"; - switch_channel_set_flag(channel, CF_REQ_MEDIA); if (!zstr(msg->string_arg) && strcasecmp(msg->string_arg, event)) { if (!strcasecmp(msg->string_arg, "hold")) { @@ -1924,6 +1923,27 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } + case SWITCH_MESSAGE_INDICATE_INFO: + { + char *headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_INFO_HEADER_PREFIX); + char *ct = "freeswitch/data"; + const char *pl = NULL; + + if (!zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { + ct = switch_core_session_sprintf(session, "%s/%s", msg->string_array_arg[0], msg->string_array_arg[1]); + } + + if (!zstr(msg->string_array_arg[2])) { + pl = msg->string_array_arg[2]; + } + + nua_info(tech_pvt->nh, + SIPTAG_CONTENT_TYPE_STR(ct), + TAG_IF(!zstr(headers), SIPTAG_HEADER_STR(headers)), + TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), + TAG_IF(pl, SIPTAG_PAYLOAD_STR(pl)), + TAG_END()); + } break; case SWITCH_MESSAGE_INDICATE_SIMPLIFY: { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 4a74ce3735..6b4d938c11 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -95,6 +95,8 @@ typedef struct private_object private_object_t; #define SOFIA_MULTIPART_PREFIX "sip_mp_" #define SOFIA_MULTIPART_PREFIX_T "~sip_mp_" #define SOFIA_SIP_HEADER_PREFIX "sip_h_" +#define SOFIA_SIP_INFO_HEADER_PREFIX "sip_info_h_" +#define SOFIA_SIP_INFO_HEADER_PREFIX_T "~sip_info_h_" #define SOFIA_SIP_RESPONSE_HEADER_PREFIX "sip_rh_" #define SOFIA_SIP_RESPONSE_HEADER_PREFIX_T "~sip_rh_" #define SOFIA_SIP_BYE_HEADER_PREFIX "sip_bye_h_" @@ -1108,7 +1110,7 @@ void sofia_glue_free_destination(sofia_destination_t *dst); switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, const char *body, const char *o_contact, const char *network_ip); char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix); -void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix); +void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *sip, const char *prefix); void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg); void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send); void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 3efd02cd8f..399ee3d19e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -617,7 +617,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, switch_channel_set_variable(channel, "sip_term_cause", st); extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_BYE_HEADER_PREFIX); - sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_BYE_HEADER_PREFIX); + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_BYE_HEADER_PREFIX); if (!(vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) || switch_true(vval)) { switch_core_session_t *nsession = NULL; @@ -4714,9 +4714,9 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status const char *vval; if (status > 199) { - sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX); + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_RESPONSE_HEADER_PREFIX); } else { - sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX); + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX); } @@ -6122,7 +6122,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (phrase) { switch_channel_set_variable_partner(channel, "sip_hangup_phrase", phrase); } - sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_BYE_HEADER_PREFIX); + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_BYE_HEADER_PREFIX); } switch_snprintf(st, sizeof(st), "%d", cause); switch_channel_set_variable(channel, "sip_term_cause", st); @@ -6957,9 +6957,38 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t if (session) { /* Get the channel */ switch_channel_t *channel = switch_core_session_get_channel(session); + const char *vval; /* Barf if we didn't get our private */ assert(switch_core_session_get_private(session)); + + sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_INFO_HEADER_PREFIX); + + if (!(vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) || switch_true(vval)) { + switch_core_session_t *nsession = NULL; + + switch_core_session_get_partner(session, &nsession); + + if (nsession) { + switch_core_session_message_t *msg; + + switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_INFO_HEADER_PREFIX_T); + msg = switch_core_session_alloc(nsession, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_INFO; + + if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype && + sip->sip_payload && sip->sip_payload->pl_data) { + msg->string_array_arg[0] = switch_core_session_strdup(nsession, sip->sip_content_type->c_type); + msg->string_array_arg[1] = switch_core_session_strdup(nsession, sip->sip_content_type->c_subtype); + msg->string_array_arg[0] = switch_core_session_strdup(nsession, sip->sip_payload->pl_data); + } + msg->from = __FILE__; + switch_core_session_queue_message(nsession, msg); + + switch_core_session_rwunlock(nsession); + } + } if (sip && sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type && !strncasecmp(sip->sip_content_type->c_type, "message", 7) && diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 41048a1d84..e4b8b567ba 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1908,11 +1908,14 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix return extra_headers; } -void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix) +void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *sip, const char *prefix) { sip_unknown_t *un; char name[512] = ""; + switch_channel_t *channel = switch_core_session_get_channel(session); + char *pstr; + if (!sip || !channel) { return; } @@ -1925,6 +1928,13 @@ void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, c } } } + + pstr = switch_core_session_sprintf(session, "execute_on_%sprefix", prefix); + switch_channel_execute_on(channel, pstr); + switch_channel_api_on(channel, pstr); + + switch_channel_execute_on(channel, "execute_on_sip_extra_headers"); + switch_channel_api_on(channel, "api_on_sip_extra_headers"); }