Commit 7acf1678 authored by smorlat's avatar smorlat
Browse files

fix bug with aborted calls.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@235 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent ff8f8fac
...@@ -27,9 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -27,9 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static int linphone_answer_sdp(LinphoneCore *lc, eXosip_event_t *ev, sdp_message_t *sdp); static int linphone_answer_sdp(LinphoneCore *lc, eXosip_event_t *ev, sdp_message_t *sdp);
static bool_t linphone_call_matches_event(LinphoneCall *call, eXosip_event_t *ev){
return call->cid==ev->cid;
}
static void linphone_call_proceeding(LinphoneCore *lc, eXosip_event_t *ev){ static void linphone_call_proceeding(LinphoneCore *lc, eXosip_event_t *ev){
if (lc->call==NULL){ if (lc->call==NULL || (lc->call->cid!=-1 && !linphone_call_matches_event(lc->call,ev)) ) {
ms_warning("Bug in call_proceeding()"); ms_warning("This call has been canceled.");
eXosip_lock();
eXosip_call_terminate(ev->cid,ev->did);
eXosip_unlock();
return; return;
} }
lc->call->cid=ev->cid; lc->call->cid=ev->cid;
...@@ -65,6 +72,7 @@ int linphone_call_accepted(LinphoneCore *lc, eXosip_event_t *ev) ...@@ -65,6 +72,7 @@ int linphone_call_accepted(LinphoneCore *lc, eXosip_event_t *ev)
return 0; return 0;
} }
linphone_call_proceeding(lc,ev); linphone_call_proceeding(lc,ev);
if (!linphone_call_matches_event(lc->call,ev)) return 0;
call->auth_pending=FALSE; call->auth_pending=FALSE;
if (call->state==LCStateAVRunning){ if (call->state==LCStateAVRunning){
return 0; /*already accepted*/ return 0; /*already accepted*/
...@@ -154,6 +162,15 @@ int linphone_call_failure(LinphoneCore *lc, eXosip_event_t *ev) ...@@ -154,6 +162,15 @@ int linphone_call_failure(LinphoneCore *lc, eXosip_event_t *ev)
char *msg603=_("Call declined."); char *msg603=_("Call declined.");
char* tmpmsg=msg486; char* tmpmsg=msg486;
int code; int code;
LinphoneCall *call=lc->call;
if (call){
/*check that the faillure is related to this call, not an old one*/
if (!linphone_call_matches_event(call,ev)) {
ms_warning("Failure reported for an old call.");
return 0;
}
}
if (ev->response){ if (ev->response){
code=osip_message_get_status_code(ev->response); code=osip_message_get_status_code(ev->response);
...@@ -220,8 +237,8 @@ int linphone_call_failure(LinphoneCore *lc, eXosip_event_t *ev) ...@@ -220,8 +237,8 @@ int linphone_call_failure(LinphoneCore *lc, eXosip_event_t *ev)
lc->ringstream=NULL; lc->ringstream=NULL;
} }
linphone_core_stop_media_streams(lc); linphone_core_stop_media_streams(lc);
if (lc->call!=NULL) { if (call!=NULL) {
linphone_call_destroy(lc->call); linphone_call_destroy(call);
gstate_new_state(lc, GSTATE_CALL_ERROR, NULL); gstate_new_state(lc, GSTATE_CALL_ERROR, NULL);
lc->call=NULL; lc->call=NULL;
} }
...@@ -807,7 +824,7 @@ void linphone_call_ringing(LinphoneCore *lc, eXosip_event_t *ev){ ...@@ -807,7 +824,7 @@ void linphone_call_ringing(LinphoneCore *lc, eXosip_event_t *ev){
LinphoneCall *call=lc->call; LinphoneCall *call=lc->call;
linphone_call_proceeding(lc,ev); linphone_call_proceeding(lc,ev);
if (call==NULL) return;
if (sdp==NULL){ if (sdp==NULL){
if (lc->ringstream!=NULL) return; /*already ringing !*/ if (lc->ringstream!=NULL) return; /*already ringing !*/
if (lc->sound_conf.play_sndcard!=NULL){ if (lc->sound_conf.play_sndcard!=NULL){
......
...@@ -34,7 +34,7 @@ void stophandler(int signum) ...@@ -34,7 +34,7 @@ void stophandler(int signum)
runcond=0; runcond=0;
} }
static char *help="usage: rtpsend filename dest_ip4addr dest_port [ --with-clockslide <value> ] [ --with-jitter <milliseconds>]\n"; static const char *help="usage: rtpsend filename dest_ip4addr dest_port [ --with-clockslide <value> ] [ --with-jitter <milliseconds>]\n";
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment