asterisk/res
Joshua Colp 2fa1ff6e75 res_pjsip_multihomed: Add module which places the correct address within messages.
Due to how messages are handled within PJSIP it is not until a message is actually
sent that the destination is reliably known. This means that the addresses placed
within the message may not be of the interface the message is being sent out on.

This module determines what interface a message is being sent on and updates the
message to contain the correct address if applicable.

This module was tested by myself in a virtualized environment with multiple interfaces
and also by Kinsey Moore in the following configuration:

Networks:
* 10.24.16.0/21
** hard phone
** default gateway
* 10.24.64.0/21
** softphone with pjsip-based stack

Transport details:
bind address: 0.0.0.0
protocol: UDP

All endpoints were tested with explicitly configured transports and unconfigured transports.

This was tested with inbound and outbound calls, both of which were experiencing detrimental
effects from incorrect IP addresses in SIP messages. These effects were only experienced by the
soft phone on the 10.24.64.0 network since the messages to the hard phone on the 10.24.16.0
network had the correct IP address.

(closes issue ASTERISK-23020)
Reported by: xrobau

Review: https://reviewboard.asterisk.org/r/3102/
........

Merged revisions 410451 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-03-11 16:07:42 +00:00
..
ael Remove extra defines of AST_PBX_MAX_STACK. 2014-02-22 02:31:04 +00:00
ari unqiueid: correct max uniqueid length test 2014-03-10 16:33:10 +00:00
parking uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_pjsip AST-2014-003: res_pjsip: When handling 401/407 responses don't assume a request will have an endpoint. 2014-03-10 12:53:00 +00:00
snmp Get the SNMP code to compile. 2013-08-02 15:01:37 +00:00
stasis uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
stasis_recording MALLOC_DEBUG: Fix some misuses of free() when MALLOC_DEBUG is enabled. 2013-10-02 17:12:49 +00:00
ari.make ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
Makefile ARI: Implement /recordings/stored API's 2013-08-30 13:28:50 +00:00
res_adsi.c Multiple revisions 369323-369324 2012-06-25 15:55:25 +00:00
res_ael_share.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_ael_share.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_agi.c channel locking: Add locking for channel snapshot creation 2013-12-18 20:33:37 +00:00
res_agi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_ari.c res_ari: Make some additional error responses consistent with the rest of the system. 2014-02-26 17:04:38 +00:00
res_ari.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_applications.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_asterisk.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_bridges.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_ari_channels.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_ari_device_states.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_endpoints.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_events.c ari: User better nicknames for ARI operations 2013-11-07 21:10:31 +00:00
res_ari_mailboxes.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_model.c ARI: Add subscription support 2013-10-04 16:01:48 +00:00
res_ari_model.exports.in Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_ari_playbacks.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_ari_recordings.c ari:Add application/json parameter support 2013-11-27 15:48:39 +00:00
res_ari_sounds.c ARI: Support channel variables in originate 2014-01-21 14:27:21 +00:00
res_calendar.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_calendar.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_calendar_caldav.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_calendar_ews.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_calendar_exchange.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_calendar_icalendar.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_chan_stats.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_clialiases.c res_clialiases: Fix crash when reloading and re-aliasing an alias that is in use. 2014-02-04 02:22:28 +00:00
res_clioriginate.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_config_curl.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_ldap.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_config_odbc.c Fix Finding Extensions With Patterns Using ODBC Realtime 2013-05-10 20:28:18 +00:00
res_config_pgsql.c res_config_pgsql: Fix ast_update2_realtime calls. 2014-02-10 16:49:40 +00:00
res_config_sqlite.c res_config_sqlite: Check for CDR unregistration failures 2013-12-08 05:59:46 +00:00
res_config_sqlite3.c Add support for a realtime sorcery module. 2013-04-27 12:01:29 +00:00
res_convert.c Merged revisions 328247 via svnmerge from 2011-07-14 20:28:54 +00:00
res_corosync.c Disable build of res_corosync until it is back in a compiling state 2013-08-18 02:55:54 +00:00
res_crypto.c Doxygen Updates - janitor work 2012-09-21 17:14:59 +00:00
res_crypto.exports.in Remove built-in AES code and use optional_api instead 2010-07-21 19:11:32 +00:00
res_curl.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_fax.c json: Fix off-nominal json ref counting issues. 2014-02-21 18:04:54 +00:00
res_fax.exports.in Log spandsp's fax debug output to the FAX logger level. 2010-05-21 15:15:58 +00:00
res_fax_spandsp.c res_fax_spandsp: Fix crash when passing ulaw/alaw data to spandsp 2014-03-06 02:22:59 +00:00
res_format_attr_celt.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_format_attr_h263.c Reduce memory consumption and add the H.264 and H.263 modules I shamefully neglected to add. 2012-07-13 18:41:07 +00:00
res_format_attr_h264.c AST-2013-001: Prevent buffer overflow through H.264 format negotiation 2013-03-27 14:28:36 +00:00
res_format_attr_opus.c Add pass through support for Opus and VP8; Opus format attribute negotiation 2013-08-23 15:42:27 +00:00
res_format_attr_silk.c Add support for parsing SDP attributes, generating SDP attributes, and passing it through. 2012-07-13 16:49:40 +00:00
res_http_post.c Avoid cppcheck warnings; removing unused vars and a bit of cleanup. 2012-04-17 18:57:40 +00:00
res_http_websocket.c Fix res/res_http_websocket.c build failure in 32bit due to incorrect print format for uint64_t 2014-03-05 16:26:38 +00:00
res_http_websocket.exports.in Shuffle RESTful URL's around. 2013-07-03 16:32:00 +00:00
res_jabber.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_jabber.exports.in Fix chan_jingle/gtalk load regression introduced in r346087 2011-12-05 14:47:11 +00:00
res_limit.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_monitor.c Update Asterisk's CDRs for the new bridging framework 2013-06-17 03:00:38 +00:00
res_monitor.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_musiconhold.c moh: fix a refcount error with realtime MOH 2014-03-06 23:43:34 +00:00
res_mutestream.c ARI: Add support for suppressing media streams. 2013-07-18 16:03:12 +00:00
res_mwi_external.c External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external.exports.in External MWI core support. 2014-01-06 17:45:25 +00:00
res_mwi_external_ami.c External MWI AMI support. 2014-01-06 17:49:05 +00:00
res_odbc.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_odbc.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_parking.c res_parking: Update XML documention for DTMF features after parking timeout. 2013-10-22 16:28:05 +00:00
res_phoneprov.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_pjsip.c AST-2014-003: res_pjsip: When handling 401/407 responses don't assume a request will have an endpoint. 2014-03-10 12:53:00 +00:00
res_pjsip.exports.in res_pjsip: AMI commands and events. 2013-11-23 17:26:57 +00:00
res_pjsip_acl.c sorcery: Create AST_SORCERY dialplan function. 2014-03-06 22:39:54 +00:00
res_pjsip_authenticator_digest.c res_pjsip_authenticator_digest: Fix md5 hash buffer 2014-01-03 21:13:30 +00:00
res_pjsip_caller_id.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_diversion.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_dtmf_info.c Prevent a crash in res_pjsip_dtmf_info.c 2013-09-03 18:09:02 +00:00
res_pjsip_endpoint_identifier_anonymous.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_endpoint_identifier_ip.c pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup. 2014-03-08 16:50:36 +00:00
res_pjsip_endpoint_identifier_user.c PJSIP: Add log messages when requests are received for non-existent endpoints 2013-10-25 17:41:38 +00:00
res_pjsip_exten_state.c res_pjsip_exten_state: Presence for digium phones 2014-02-25 17:51:51 +00:00
res_pjsip_exten_state.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_header_funcs.c res_pjsip_send_to_voicemail: transferring to voicemail for digium phones 2014-02-25 17:47:06 +00:00
res_pjsip_log_forwarder.c res_pjsip: Forward PJSIP logging to Asterisk logging 2013-09-13 14:22:07 +00:00
res_pjsip_logger.c res_pjsip: Updates and adds more PJSIP CLI commands. 2014-02-06 17:55:45 +00:00
res_pjsip_messaging.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_multihomed.c res_pjsip_multihomed: Add module which places the correct address within messages. 2014-03-11 16:07:42 +00:00
res_pjsip_mwi.c Don't attempt to link in an aggregate MWI subscription if an endpoint does not aggregate MWI. 2014-03-06 15:58:13 +00:00
res_pjsip_mwi_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_nat.c PJSIP: Fix address for ACK in NAT situations 2014-01-31 15:08:49 +00:00
res_pjsip_notify.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_one_touch_record_info.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_outbound_authenticator_digest.c Switch PJSIP auth to use a vector. 2013-12-09 16:10:05 +00:00
res_pjsip_outbound_registration.c pjsip_cli: Create pjsip show channel and contact, and general cli code cleanup. 2014-03-08 16:50:36 +00:00
res_pjsip_path.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_pidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pidf_digium_body_supplement.c res_pjsip_exten_state: Presence for digium phones 2014-02-25 17:51:51 +00:00
res_pjsip_pidf_eyebeam_body_supplement.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_pubsub.c Remove all PJSIP MWI-specific use from our MWI code. 2014-02-13 18:52:08 +00:00
res_pjsip_pubsub.exports.in Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pjsip_refer.c PJSIP: Prevent crash if channel has gone away 2014-02-26 13:45:12 +00:00
res_pjsip_registrar.c Store SIP User-Agent information in contacts. 2014-02-17 15:36:45 +00:00
res_pjsip_registrar_expire.c sorcery, bucket: Change observer remove calls to take const callbacks struct. 2013-12-03 17:35:54 +00:00
res_pjsip_rfc3326.c The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_sdp_rtp.c res_pjsip_sdp_rtp: Apply packetization rules on inbound SDP handling 2014-02-27 12:29:56 +00:00
res_pjsip_send_to_voicemail.c res_pjsip_send_to_voicemail: transferring to voicemail for digium phones 2014-02-25 17:47:06 +00:00
res_pjsip_session.c res_pjsip_session: Set options (100rel, timers) on incoming sessions. 2014-03-01 20:28:04 +00:00
res_pjsip_session.exports.in The large GULP->PJSIP renaming effort. 2013-07-30 18:14:50 +00:00
res_pjsip_t38.c PJSIP: Add Path header support 2014-01-15 13:16:10 +00:00
res_pjsip_transport_websocket.c res_pjsip_transport_websocket: Fix security events and simplify implementation. 2013-12-01 19:58:08 +00:00
res_pjsip_xpidf_body_generator.c Decouple subscription handling from NOTIFY/PUBLISH body generation. 2014-01-31 22:27:07 +00:00
res_pktccops.c Fix compilation on gcc 4.8.1 2013-07-30 13:46:16 +00:00
res_pktccops.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_realtime.c Cleanup references to sipusers and sipfriends dynamic realtime families 2011-11-01 19:53:26 +00:00
res_rtp_asterisk.c res_rtp_asterisk: Fix one way audio problems with hold/unhold when using ICE 2014-03-04 17:22:32 +00:00
res_rtp_multicast.c res_rtp_multicast: Ensure SSRC is set properly 2013-10-03 18:32:59 +00:00
res_security_log.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_smdi.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_smdi.exports.in Allow symbol export filtering to work properly on platforms that have symbol prefixes. 2010-04-02 18:57:58 +00:00
res_snmp.c Doxygen Updates - Title update 2012-10-14 21:44:27 +00:00
res_sorcery_astdb.c json: Fix off-nominal json ref counting issues. 2014-02-21 18:04:54 +00:00
res_sorcery_config.c res_sorcery_config: Output an error message when an object can't be created. 2013-12-17 18:35:39 +00:00
res_sorcery_memory.c Pass the sorcery instance to wizards for CUD operations as well as retrieve. 2013-03-20 14:52:23 +00:00
res_sorcery_realtime.c Make res_sorcery_realtime filter unknown retrieved results. 2014-03-07 21:23:39 +00:00
res_speech.c Add support for retrieving engine specific settings using the speech API and from dialplan. 2012-10-01 12:29:04 +00:00
res_speech.exports.in app_speech_utils: Fix unresolved symbol ast_speech_get_setting(). 2013-09-16 18:00:32 +00:00
res_srtp.c Use srtp_shutdown when available 2013-05-15 12:42:04 +00:00
res_srtp.exports.in Add SRTP support for Asterisk 2010-06-08 05:29:08 +00:00
res_stasis.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_stasis.exports.in Moved core logic from app_stasis to res_stasis 2013-04-15 16:43:47 +00:00
res_stasis_answer.c ARI: Adding a channel to a bridge while a live recording is active blocks 2013-12-13 16:38:57 +00:00
res_stasis_answer.exports.in Add missing exports file 2013-05-20 14:21:39 +00:00
res_stasis_device_state.c ARI: Make double subscribe respond with success 2014-01-28 19:19:08 +00:00
res_stasis_device_state.exports.in ARI: Implement device state API 2013-11-23 17:48:28 +00:00
res_stasis_mailbox.c ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_mailbox.exports.in ARI: Add mailboxes resource for controlling and polling external MWI 2014-01-14 23:44:57 +00:00
res_stasis_playback.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_stasis_playback.exports.in This patch implements the REST API's for POST /channels/{channelId}/play 2013-05-23 20:11:35 +00:00
res_stasis_recording.c res_stasis_recording: Add a "target_uri" field to recording events. 2014-03-06 18:20:37 +00:00
res_stasis_recording.exports.in ARI - channel recording support 2013-07-03 17:58:45 +00:00
res_stasis_snoop.c uniqueid: channel linkedid, ami, ari object creation with id's 2014-03-07 15:47:55 +00:00
res_stasis_snoop.exports.in ari: Add Snoop operation for spying/whispering on channels. 2013-11-23 12:40:46 +00:00
res_stasis_test.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00
res_stasis_test.exports.in Initial support for endpoints. 2013-05-08 13:39:08 +00:00
res_statsd.c Rename everything Stasis-HTTP to ARI 2013-07-27 23:11:02 +00:00
res_statsd.exports.in Example of how to use the Stasis message bus 2013-04-26 20:05:15 +00:00
res_stun_monitor.c Move channel driver Registry manager events to core. 2013-07-08 14:42:57 +00:00
res_timing_dahdi.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_kqueue.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_pthread.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_timing_timerfd.c timing: Improve performance for most timing implementations. 2014-02-07 20:01:45 +00:00
res_xmpp.c Voicemail: Remove mailbox identifier format (box@context) assumptions in the system. 2013-12-19 16:52:43 +00:00
res_xmpp.exports.in Add a new unified Jingle, Google Jingle, and Google Talk channel driver written from scratch called chan_motif. 2012-07-07 17:06:51 +00:00