how to add ring back for sip to sip calling at caller side...

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

 



Dear Sir,

i have a voip application using pjsip in which we want to add ring back tone
for caller.

in this application i have fake ring which working for incoming call that
ring at callee side when incomming call come for both sip to sip & sip to
GSM both.

but when i used sip to sip call there is no any ring at caller side so that
no any confirmation that call is going or not when call connected voice is
coming.

please suggest how we enable ring at caller side for sip to sip calling so
that caller understand call is going or not?

please see code for incomming & outgoing call below-

// this is for incoming call
void on_incoming_call(const wchar_t* caller_disp, const wchar_t* caller_uri)
{
    bconnected = FALSE;
    pjsua_call_answer(g_call_id, 180, NULL, NULL);
    myinstance->DisplayMessage(_L("Incoming..."));
    TBuf<512> buf;
    TPtrC aDisp((const TUint16*)caller_disp);
    TPtrC aUri((const TUint16*)caller_uri);
    _LIT(KFormat, "Incoming call from %S, accept?");

    buf.Format(KFormat, &aDisp);
    pl = CSoundPlayer::NewL(_L("C:\\data\\ring.wav"));// fake ring
    pl->Play();
    pl->RepeatSound();

    if (CMobileDialerContainerView::RunConfQuery_acceptcallL(&buf) ==
EAknSoftkeyYes)
    {
        CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
        if (cba != NULL) {
            TRAPD(result,
cba->SetCommandL(EMobileDialerContainerViewControlPaneRightId, KStHangUp));
            cba->DrawDeferred();
        }
        pl->Stop();
        symbian_ua_answercall();
    } else {
        pl->Stop();
        symbian_ua_endcall();
    }
}


// outgoing call code

TBool CMobileDialerContainerView::CallSoftKeyPressedL( TInt aCommand )
    {
    // TODO: implement rightSoftKeyPressed event handler
    if(reg_status==TRUE)
            {

            CEikEdwin *obj_url = (CEikEdwin*)
iMobileDialerContainer->ComponentControl(iMobileDialerContainer->EEd_url);
               CEikButtonGroupContainer* cba =
CEikButtonGroupContainer::Current();
                 if( cba )
                   {
                   const TDesC* txt;
                   MEikButtonGroup* buttonGroup = cba->ButtonGroup();
                   CCoeControl* button = buttonGroup->GroupControlById(
EMobileDialerContainerViewControlPaneRightId );
                   if( buttonGroup->IsCommandVisible(
EMobileDialerContainerViewControlPaneRightId ))
                         {
                           CEikLabel* label = static_cast<CEikLabel*>(
button->ComponentControl(0) );
                           txt = label->Text();

                         }

if((iMobileDialerContainer->SipUrlLength()<=0)&&txt->Compare(KStCall)==0)
                           {
                           TPtrC st_warning(_L("Please Enter a Number"));

CMobileDialerContainerView::RunNote1L(&st_warning);
                           return ETrue;
                           }
                   else
if((iMobileDialerContainer->SipUrlLength()>20)&&txt->Compare(KStCall)==0)
                       {
                       myinstance->DisplayMessage(_L("Call Not
Allowed..."));
                    return ETrue;
                       }
                   }

            if (symbian_ua_anycall()) {     //pjsip function
                                 symbian_ua_endcall();
                                 return ETrue;
                                     }


            TUint8 url[256];
            TPtr8 aUrl(url, 256);

            HBufC *buf = obj_url->GetTextInHBufL();
            TBuf<50> num(buf->Des());
            CnvUtfConverter::ConvertFromUnicodeToUtf8(aUrl, *buf);
            delete buf;
            aUrl.TrimAll();

            number=num;
            TUint8 sipip[256];
            TPtr8 asipip(sipip,256);

            asipip.Append(_L("sip:"));
            asipip.Append(aUrl);
            asipip.Append(_L("@"));

            CMobileDialerSettingItemListView* ss =
CMobileDialerSettingItemListView::NewL();
            asipip.Append(ss->getsipip());
            delete ss;

            myinstance->DisplayMessage(_L("Calling..."));
            pjsua_call_answer(g_call_id, 180, NULL, NULL);
            pl = CSoundPlayer::NewL(_L("C:\\data\\ring.wav"));
            pl->Play();
            pl->RepeatSound();

            if ( cba != NULL ) {
            cba->SetCommandL(aCommand, KStHangUp);
            cba->DrawDeferred();
            }

            if (symbian_ua_makecall((char *)asipip.PtrZ()) != 0)
            {

            myinstance->DisplayMessage(_L("Ready to Call..."));
                if ( cba != NULL )
                {
                    cba->SetCommandL(aCommand, KStCall);
                    cba->DrawDeferred();
                }
            }
        }
        else
        {
               myinstance->DisplayMessage(_L("Call Not Allowed..."));
        }
    return ETrue;
    }


Regards,
Satish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101221/603cbcc8/attachment.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux