Skip to content
Snippets Groups Projects
Commit 9130109e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#1714] Missing true

parent 2f3b9ae3
Branches
Tags
No related merge requests found
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define CAN_REINVITE 1 #define CAN_REINVITE 1
const pj_str_t STR_USER_AGENT = { ( char* ) "User-Agent", 10 }; const pj_str_t STR_USER_AGENT = { ( char* ) "User-Agent", 10 };
/**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/ /**************** EXTERN VARIABLES AND FUNCTIONS (callbacks) **************************/
...@@ -572,6 +573,7 @@ SIPVoIPLink::answer ( const CallID& id ) ...@@ -572,6 +573,7 @@ SIPVoIPLink::answer ( const CallID& id )
if ( status == PJ_SUCCESS ) if ( status == PJ_SUCCESS )
{ {
_debug ( "SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str() ); _debug ( "SIPVoIPLink::answer:UserAgent: Negociation success! : call %s \n", call->getCallId().c_str() );
// Create and send a 200(OK) response // Create and send a 200(OK) response
status = pjsip_inv_answer ( inv_session, PJSIP_SC_OK, NULL, NULL, &tdata ); status = pjsip_inv_answer ( inv_session, PJSIP_SC_OK, NULL, NULL, &tdata );
...@@ -581,6 +583,8 @@ SIPVoIPLink::answer ( const CallID& id ) ...@@ -581,6 +583,8 @@ SIPVoIPLink::answer ( const CallID& id )
call->setConnectionState ( Call::Connected ); call->setConnectionState ( Call::Connected );
call->setState ( Call::Active ); call->setState ( Call::Active );
return true;
} }
else else
{ {
...@@ -621,7 +625,6 @@ SIPVoIPLink::hangup ( const CallID& id ) ...@@ -621,7 +625,6 @@ SIPVoIPLink::hangup ( const CallID& id )
return true; return true;
// _debug("Some tdata info: %",); // _debug("Some tdata info: %",);
status = pjsip_inv_send_msg ( call->getInvSession(), tdata ); status = pjsip_inv_send_msg ( call->getInvSession(), tdata );
if ( status != PJ_SUCCESS ) if ( status != PJ_SUCCESS )
return false; return false;
...@@ -749,6 +752,7 @@ int SIPVoIPLink::inv_session_reinvite ( SIPCall *call, std::string direction ) ...@@ -749,6 +752,7 @@ int SIPVoIPLink::inv_session_reinvite ( SIPCall *call, std::string direction )
pjmedia_sdp_media_add_attr ( local_sdp->media[0], attr ); pjmedia_sdp_media_add_attr ( local_sdp->media[0], attr );
// Build the reinvite request // Build the reinvite request
status = pjsip_inv_reinvite ( call->getInvSession(), NULL, status = pjsip_inv_reinvite ( call->getInvSession(), NULL,
local_sdp, &tdata ); local_sdp, &tdata );
if ( status != PJ_SUCCESS ) if ( status != PJ_SUCCESS )
...@@ -1878,6 +1882,8 @@ void SIPVoIPLink::handle_reinvite ( SIPCall *call ) ...@@ -1878,6 +1882,8 @@ void SIPVoIPLink::handle_reinvite ( SIPCall *call )
void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e ) void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e )
{ {
_debug("--------------------- call_on_state_changed --------------------- %i\n", inv->state);
SIPCall *call; SIPCall *call;
AccountID accId; AccountID accId;
SIPVoIPLink *link; SIPVoIPLink *link;
...@@ -1987,6 +1993,9 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e ) ...@@ -1987,6 +1993,9 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e )
else if ( inv->state == PJSIP_INV_STATE_DISCONNECTED ) else if ( inv->state == PJSIP_INV_STATE_DISCONNECTED )
{ {
int count = 0;
_debug("------------------- Call disconnected ---------------------\n");
_debug("State: %i, Disconnection cause: %i\n", inv->state, inv->cause);
switch ( inv->cause ) switch ( inv->cause )
{ {
/* The call terminates normally - BYE / CANCEL */ /* The call terminates normally - BYE / CANCEL */
...@@ -2009,6 +2018,7 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e ) ...@@ -2009,6 +2018,7 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e )
case PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE: case PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE:
case PJSIP_SC_UNSUPPORTED_MEDIA_TYPE: case PJSIP_SC_UNSUPPORTED_MEDIA_TYPE:
case PJSIP_SC_UNAUTHORIZED: case PJSIP_SC_UNAUTHORIZED:
case PJSIP_SC_REQUEST_PENDING:
accId = Manager::instance().getAccountFromCall ( call->getCallId() ); accId = Manager::instance().getAccountFromCall ( call->getCallId() );
link = dynamic_cast<SIPVoIPLink *> ( Manager::instance().getAccountLink ( accId ) ); link = dynamic_cast<SIPVoIPLink *> ( Manager::instance().getAccountLink ( accId ) );
if ( link ) if ( link )
...@@ -2016,7 +2026,6 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e ) ...@@ -2016,7 +2026,6 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e )
link->SIPCallServerFailure ( call ); link->SIPCallServerFailure ( call );
} }
break; break;
default: default:
_debug ( "sipvoiplink.cpp - line 1635 : Unhandled call state. This is probably a bug.\n" ); _debug ( "sipvoiplink.cpp - line 1635 : Unhandled call state. This is probably a bug.\n" );
break; break;
...@@ -2030,6 +2039,8 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e ) ...@@ -2030,6 +2039,8 @@ void call_on_state_changed ( pjsip_inv_session *inv, pjsip_event *e )
void call_on_media_update ( pjsip_inv_session *inv, pj_status_t status ) void call_on_media_update ( pjsip_inv_session *inv, pj_status_t status )
{ {
_debug("--------------------- call_on_media_update --------------------- \n");
AccountID accId; AccountID accId;
SIPVoIPLink *link; SIPVoIPLink *link;
...@@ -2050,6 +2061,9 @@ void call_on_media_update ( pjsip_inv_session *inv, pj_status_t status ) ...@@ -2050,6 +2061,9 @@ void call_on_media_update ( pjsip_inv_session *inv, pj_status_t status )
call->getLocalSDP()->clean_session_media(); call->getLocalSDP()->clean_session_media();
// Set the fresh negociated one // Set the fresh negociated one
call->getLocalSDP()->set_negociated_offer ( r_sdp ); call->getLocalSDP()->set_negociated_offer ( r_sdp );
// call->getLocalSDP()->fetch_media_transport_info_from_remote_sdp( r_sdp );
// call->getLocalSDP()->fetch_remote_ip_from_sdp( r_sdp );
// call->getLocalSDP()->fetch_remote_audio_port_from_sdp( r_sdp );
accId = Manager::instance().getAccountFromCall ( call->getCallId() ); accId = Manager::instance().getAccountFromCall ( call->getCallId() );
link = dynamic_cast<SIPVoIPLink *> ( Manager::instance().getAccountLink ( accId ) ); link = dynamic_cast<SIPVoIPLink *> ( Manager::instance().getAccountLink ( accId ) );
...@@ -2078,6 +2092,8 @@ void call_on_forked ( pjsip_inv_session *inv, pjsip_event *e ) ...@@ -2078,6 +2092,8 @@ void call_on_forked ( pjsip_inv_session *inv, pjsip_event *e )
void call_on_tsx_changed ( pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e ) void call_on_tsx_changed ( pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e )
{ {
_debug("--------------------- call_on_state_changed --------------------- %i\n", tsx->state);
if ( tsx->role==PJSIP_ROLE_UAS && tsx->state==PJSIP_TSX_STATE_TRYING && if ( tsx->role==PJSIP_ROLE_UAS && tsx->state==PJSIP_TSX_STATE_TRYING &&
pjsip_method_cmp ( &tsx->method, &pjsip_refer_method ) ==0 ) pjsip_method_cmp ( &tsx->method, &pjsip_refer_method ) ==0 )
{ {
...@@ -2150,6 +2166,7 @@ pj_bool_t ...@@ -2150,6 +2166,7 @@ pj_bool_t
mod_on_rx_request ( pjsip_rx_data *rdata ) mod_on_rx_request ( pjsip_rx_data *rdata )
{ {
pj_status_t status; pj_status_t status;
pj_str_t reason; pj_str_t reason;
unsigned options = 0; unsigned options = 0;
...@@ -2344,6 +2361,7 @@ mod_on_rx_request ( pjsip_rx_data *rdata ) ...@@ -2344,6 +2361,7 @@ mod_on_rx_request ( pjsip_rx_data *rdata )
return true; return true;
} }
// Specify media capability during invite session creation // Specify media capability during invite session creation
status = pjsip_inv_create_uas ( dialog, rdata, call->getLocalSDP()->get_local_sdp_session(), 0, &inv ); status = pjsip_inv_create_uas ( dialog, rdata, call->getLocalSDP()->get_local_sdp_session(), 0, &inv );
PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 ); PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 );
...@@ -2354,6 +2372,7 @@ mod_on_rx_request ( pjsip_rx_data *rdata ) ...@@ -2354,6 +2372,7 @@ mod_on_rx_request ( pjsip_rx_data *rdata )
// Send a 180/Ringing response // Send a 180/Ringing response
status = pjsip_inv_initial_answer ( inv, rdata, PJSIP_SC_RINGING, NULL, NULL, &tdata ); status = pjsip_inv_initial_answer ( inv, rdata, PJSIP_SC_RINGING, NULL, NULL, &tdata );
PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 ); PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 );
status = pjsip_inv_send_msg ( inv, tdata ); status = pjsip_inv_send_msg ( inv, tdata );
PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 ); PJ_ASSERT_RETURN ( status == PJ_SUCCESS, 1 );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment