Ring tone(yet not solved)

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

 



hi all,

        Few days ago i asked about the ring tone problem, now i solved that
problem, thanks for reply. now i am in another problem, if call gets
disconnect from another side, ring tone should be stop. but i am not able to
stop ring....

void CMFCDlg::ring()
{
    pj_caching_pool_init(&cp, &pj_pool_factory_default_policy, 0);
    status = pjmedia_endpt_create(&cp.factory, NULL, 1, &med_endpt);
    pool = pj_pool_create( &cp.factory,        /* pool factory        */
               "wav",        /* pool name.        */
               4000,        /* init size        */
               4000,        /* increment size        */
               NULL            /* callback on error    */
               );
    status = pjmedia_wav_player_port_create(  pool,    /* memory pool
*/
                          soundfile,    /* file to play        */
                          20,    /* ptime.        */
                          0,    /* flags        */
                          0,    /* default buffer   */
                          &file_port/* returned port    */
                          );
    status = pjmedia_snd_port_create_player(
         pool,                    /* pool            */
         -1,                    /* use default dev.        */
         file_port->info.clock_rate,        /* clock rate.        */
         file_port->info.channel_count,        /* # of channels.        */
         file_port->info.samples_per_frame, /* samples per frame.   */
         file_port->info.bits_per_sample,   /* bits per sample.        */
         0,                    /* options            */
         &snd_port                /* returned port        */
         );
    pj_thread_sleep(100);
    status = pjmedia_snd_port_connect( snd_port, file_port);
    CCallring allring;
    if(allring.DoModal())
    pjmedia_snd_port_disconnect(snd_port);
    pj_thread_sleep(100);
    //return 0;
}

static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
                 pjsip_rx_data *rdata)
{
    CMFCDlg dlg;
    pjsua_call_answer(call_id, 180, NULL, NULL);
    dlg.ring();
    CCallring allring;
    pjsua_call_info ci;
    PJ_UNUSED_ARG(acc_id);
    PJ_UNUSED_ARG(rdata);
    pjsua_call_get_info(call_id, &ci);


    pjsua_call_answer(call_id,200,NULL,NULL);

}

static void on_call_state(pjsua_call_id call_id, pjsip_event *e)
{
    pjsua_call_info ci;
    PJ_UNUSED_ARG(e);

    pjsua_call_get_info(call_id, &ci);
    if (ci.state ==PJSIP_INV_STATE_DISCONNECTED)
        pjmedia_snd_port_disconnect(snd_port);

    }

Now with this code it is not giving any error, but also it is not
disconnecting the ring port.
where is the problem, can anyone help me.....


Regards
New_bie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090119/1b8727d9/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