Modularizando o src
Dependencies: EALib EthernetInterface_vz mbed-rtos mbed
Fork of header_main_colinas_V0-20-09-14 by
Diff: sip.cpp
- Revision:
- 135:2f4290590e51
- Parent:
- 132:05cd37f7e007
--- a/sip.cpp Tue Sep 01 19:34:34 2015 +0000 +++ b/sip.cpp Thu Sep 10 20:11:35 2015 +0000 @@ -216,9 +216,9 @@ strcpy ( callid, last_invite_callid ); } - if ( debug_invite ) vz_debug ("[%d] \r\nbranch :: %s\r\ntag :: %s\r\ncallid :: %s", this->my_ext, branch, tag, callid ); + if ( debug_invite ) vz_debug ("[%d] branch :: %s -- tag :: %s -- callid :: %s", this->my_ext, branch, tag, callid ); - if ( debug_rtp || debug_invite ) vz_debug ("[%d] Invite PKG rtp port ( %d )", this->my_ext, this->my_rtp_port ); + if ( debug_rtp || debug_invite ) vz_debug ( "[%d] Invite PKG rtp port ( %d )", this->my_ext, this->my_rtp_port ); snprintf( header, sizeof ( header ) -1, "INVITE sip:%i@%s:%i SIP/2.0\r\n" @@ -311,7 +311,6 @@ char to [ SIP_MAXMSGSIZE ]; char from [ SIP_MAXMSGSIZE ]; char callid [ SIP_MAXMSGSIZE ]; - char via [ SIP_MAXMSGSIZE ]; char branch [ SIP_MAXMSGSIZE ]; char cseq [ SIP_MAXMSGSIZE ]; @@ -331,13 +330,6 @@ decode_branch ( ( const unsigned char * ) this -> buffer, branch ); decode_cseq ( ( const unsigned char * ) this -> buffer, cseq ); - if ( strlen( via ) > 6 ) - { - if ( strcasecmp ( ";rport", via + strlen ( via ) -6 ) == 0 ) { - via [ strlen ( via ) -6 ] = 0; - } - } - snprintf ( buffer, sizeof ( buffer ) - 1, "ACK sip:%i@%s:%i SIP/2.0\r\n" "Via: SIP/2.0/UDP %s:%i;branch=%s\r\n" @@ -467,10 +459,12 @@ char * Sip::decode_cseq ( const unsigned char * package, char * cseq ) { - char pkg [ SIP_MAXMSGSIZE ], cs [ SIP_MAXMSGSIZE ]; + char pkg [ SIP_MAXMSGSIZE ]; if( decode_gettag ( package, "cseq: ", pkg ) != 0) { + char cs [ SIP_MAXMSGSIZE ]; + int i = 0; strcpy ( cs, pkg ); while ( ( cs [ i ] != 0 ) && ( cs [ i ] != ' ' ) ) i++; @@ -521,8 +515,6 @@ return 0; // not found } -int Sip::get_my_rtp_port ( void ) { return this->my_rtp_port; } - int Sip::fill_random_rtp_port ( void ) { static uint16_t port = 0; @@ -553,8 +545,6 @@ return ret; } -void Sip::set_ext ( const int ext ) { my_ext = ext; } - void Sip::set_port ( const int port ) { my_port = port; } void Sip::send_bye ( void ) @@ -627,6 +617,7 @@ ref = strtok( ref, " "); if ( call == NULL ){ call = new VZ_call ( this->my_ext, this->my_rtp_port, this->peer_ext, atoi( ref ) ); + if ( debug_alloc_vz_call ) vz_debug ( "VZ_Call :: %p", call ); if ( debug_rtp ) vz_debug ("[%d] Ok new call ( %d, %d, %d, %d ( %s ) ) ", this->my_ext, this->my_ext, this->my_rtp_port, this->peer_ext, atoi( ref ), ref ); if ( call == NULL ) memory_is_over = true; } @@ -678,6 +669,7 @@ if ( call == NULL ) { this->call = new VZ_call ( this->my_ext, this->my_rtp_port, this->peer_ext, atoi( ref ) ); + if ( debug_alloc_vz_call ) vz_debug ( "VZ_Call :: %p", this->call ); if ( debug_rtp ) vz_debug ("[%d] Session in Progress ( %d, %d, %d, %d ( %s ) ) ",this->my_ext, this->my_ext, this->my_rtp_port, this->peer_ext, atoi( ref ), ref ); if ( call == NULL ) memory_is_over = true; } @@ -711,7 +703,7 @@ { if ( debug_reconnect ) vz_debug ("" "[%d] Reconnect SIP -- RCV BYE from * -- ( expected, realized ) ( %d, %d )", - this->my_ext, strlen ( this -> buffer ), send + this -> my_ext, strlen ( this -> buffer ), send ); __reconnect__ ();