From: <cha...@us...> - 2008-08-15 18:13:05
|
Revision: 523 http://sipp.svn.sourceforge.net/sipp/?rev=523&view=rev Author: charlespwright Date: 2008-08-15 18:13:02 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Fix: If a call was created without a source (e.g., via 3pcc), allow the source to be set on the first incoming SIP message. Modified Paths: -------------- sipp/trunk/call.cpp sipp/trunk/call.hpp sipp/trunk/deadcall.cpp sipp/trunk/deadcall.hpp sipp/trunk/listener.hpp sipp/trunk/sipp.cpp Modified: sipp/trunk/call.cpp =================================================================== --- sipp/trunk/call.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/call.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -2819,7 +2819,7 @@ queued_msg = strdup(msg); } -bool call::process_incoming(char * msg) +bool call::process_incoming(char * msg, struct sockaddr_storage *src) { int reply_code; static char request[65]; @@ -2839,6 +2839,11 @@ /* Ignore the messages received during a pause if -pause_msg_ign is set */ if(call_scenario->messages[msg_index] -> M_type == MSG_TYPE_PAUSE && pause_msg_ign) return(true); + /* Get our destination if we have none. */ + if (call_peer.ss_family == AF_UNSPEC && src) { + memcpy(&call_peer, src, SOCK_ADDR_SIZE(src)); + } + /* Authorize nop as a first command, even in server mode */ if((msg_index == 0) && (call_scenario->messages[msg_index] -> M_type == MSG_TYPE_NOP)) { queue_up (msg); Modified: sipp/trunk/call.hpp =================================================================== --- sipp/trunk/call.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/call.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -74,7 +74,7 @@ virtual ~call(); - virtual bool process_incoming(char * msg); + virtual bool process_incoming(char * msg, struct sockaddr_storage *src = NULL); virtual bool process_twinSippCom(char * msg); virtual bool run(); Modified: sipp/trunk/deadcall.cpp =================================================================== --- sipp/trunk/deadcall.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/deadcall.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -62,7 +62,7 @@ free(reason); } -bool deadcall::process_incoming(char * msg) { +bool deadcall::process_incoming(char * msg, struct sockaddr_storage *src) { char buffer[MAX_HEADER_LEN]; CStat::globalStat(CStat::E_DEAD_CALL_MSGS); Modified: sipp/trunk/deadcall.hpp =================================================================== --- sipp/trunk/deadcall.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/deadcall.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -5,7 +5,7 @@ deadcall(char *id, char * reason); ~deadcall(); - virtual bool process_incoming(char * msg); + virtual bool process_incoming(char * msg, struct sockaddr_storage *); virtual bool process_twinSippCom(char * msg); virtual bool run(); Modified: sipp/trunk/listener.hpp =================================================================== --- sipp/trunk/listener.hpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/listener.hpp 2008-08-15 18:13:02 UTC (rev 523) @@ -34,7 +34,7 @@ listener(char *id, bool listening); virtual ~listener(); char *getId(); - virtual bool process_incoming(char * msg) = 0; + virtual bool process_incoming(char * msg, struct sockaddr_storage *src) = 0; virtual bool process_twinSippCom(char * msg) = 0; protected: Modified: sipp/trunk/sipp.cpp =================================================================== --- sipp/trunk/sipp.cpp 2008-07-28 01:27:05 UTC (rev 522) +++ sipp/trunk/sipp.cpp 2008-08-15 18:13:02 UTC (rev 523) @@ -3067,7 +3067,7 @@ ERROR("Out of memory allocating a call!"); } CStat::globalStat(CStat::E_AUTO_ANSWERED); - call_ptr->process_incoming(msg); + call_ptr->process_incoming(msg, src); } else { /* We received a response not relating to any known call */ /* Do nothing, even if in auto answer mode */ @@ -3091,7 +3091,7 @@ } else { - listener_ptr -> process_incoming(msg); + listener_ptr -> process_incoming(msg, src); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |