linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] coreapi/callbacks.c : Call state Remote ringing :


From: Romary Sonrier
Subject: [Linphone-developers] coreapi/callbacks.c : Call state Remote ringing : Set only when soundcard working
Date: Fri, 11 Feb 2011 11:38:12 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

Hello,

I have a question about the following piece of code ( from coreapi/callbacks.c) :

The function call_ringing function, only call
                                linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");
when the soundcard works. This is depending of the meaning of the state LinphoneCallOutgoingRinging, which seems to be done when the remote is ringing.

In my case, i don't use soundcards, but files instead, so i don't get the call state "Ringing", which is a issue to me.

static void call_ringing(SalOp *h){
        LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
        LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(h);
        SalMediaDescription *md;

        if (call==NULL) return;

        if (lc->vtable.display_status)
                lc->vtable.display_status(lc,_("Remote ringing."));

        md=sal_call_get_final_media_description(h);
        if (md==NULL){
                if (lc->ringstream && lc->dmfs_playing_start_time!=0){
                        ring_stop(lc->ringstream);
                        lc->ringstream=NULL;
                        lc->dmfs_playing_start_time=0;
                }
                if (lc->ringstream!=NULL) return;       /*already ringing !*/
                if (lc->sound_conf.play_sndcard!=NULL){
                        MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
                        ms_message("Remote ringing...");
                        lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard);
                        linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");
                }

        }else{
                /*accept early media */
                if (call->audiostream && call->audiostream->ticker!=NULL){
                        /*streams already started */
                        ms_message("Early media already started.");
                        return;
                }
                if (lc->vtable.show) lc->vtable.show(lc);
                if (lc->vtable.display_status)
                        lc->vtable.display_status(lc,_("Early media."));
                linphone_call_set_state(call,LinphoneCallOutgoingEarlyMedia,"Early media");
                if (lc->ringstream!=NULL){
                        ring_stop(lc->ringstream);
                        lc->ringstream=NULL;
                }
                ms_message("Doing early media...");
                linphone_core_update_streams (lc,call,md);
        }
}


So i made a small patch, to resolved this issue.
diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c
index f40cc44..9fc36b8 100644
--- a/coreapi/callbacks.c
+++ b/coreapi/callbacks.c
@@ -237,8 +237,8 @@ static void call_ringing(SalOp *h){
                        MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
                        ms_message("Remote ringing...");
                        lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard);
-                       linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");            
                }
+               linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");            
        }else{
                /*accept early media */
                if (call->audiostream && call->audiostream->ticker!=NULL){

There is still an issue, maybe, because linphone_call_set_state could be called each time a 180/ringing packet arrives.

Another patch that could be done, woudl be to add a new call state LinphoneCallOutgoingRemoteRinging ( and replace LinphoneCallOutgoingRinging  by LinphoneCallOutgoingLocalRinging ), This would permit to clearly distinguish which side of the call is ringing.

Does someone have a point of view on this suject ?
What would be the right way to have a more generic API ?


Regards,

Romary

reply via email to

[Prev in Thread] Current Thread [Next in Thread]