How to play a "splash-tone" file as soon as posssible in the call sequence

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

 



Whilst studying the pjproject-2.2.1/pjsip-apps/src/pjsua files for how to cause a "PleaseLeaveYourMessage auto-play to happen, a few things:
1: my app (running on ARM7) receives my test call from a company digital phone via a gateway; this should make no difference.
    You asked for example code; after applying what I could grasp from the auto-play example, here's what I think should work but doesn't (with lots trimmed out)
if ((status = pjsua_create()) != PJ_SUCCESS) SleepForever("Can't create PJSUA, is it already running?",status);
if ((status = pjsua_verify_url(LV.MyURI)) != PJ_SUCCESS) SleepForever("Fix your bad URI, Doofus!",status);
if ((status = pjsua_init(&ep_cfg, &ep_logging_cfg, NULL))  != PJ_SUCCESS) SleepForever("Error in pjsua_init()", status);
if ((status = pjsip_endpt_register_module(pjsua_get_pjsip_endpt(), &mod_default_handler)) != PJ_SUCCESS) SleepForever("Can't register Endpoint", status);
if ((status = pjsua_player_create(&LV.PleaseLeaveYourMessage, PJMEDIA_FILE_NO_LOOP, &LV.Player_id)) != PJ_SUCCESS) SleepForever("Can't create SplashPlayer",status);
LV.PlayerConferencePortNo = pjsua_player_get_conf_port(LV.Player_id);
pjsua_player_get_port(LV.Player_id, &LV.SplashPort);
if ((status = pjmedia_wav_player_set_eof_cb(LV.SplashPort, NULL, &on_playfile_done)) != PJ_SUCCESS) SleepForever("Can't set eof cb",status);
if ((status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &tcfg, NULL)) != PJ_SUCCESS) SleepForever("Can't create transport, bad config data?",status);
if ((status = pjsua_acc_add(&acct_cfg, PJ_TRUE, &LV.MyAcctId)) != PJ_SUCCESS) SleepForever("Can't create account (you are a no-account!)",status);
if ((status = pjsua_start()) != PJ_SUCCESS) SleepForever("Can't start pjsua.  Need more chocolate?",status);

The callbacks that appear to matter (with lots trimmed out, you don't want to read a book):
void cb_on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata)
{
    pjsua_call_answer(call_id, 200, NULL, NULL);
}
static void cb_on_call_media_state(pjsua_call_id call_id)
{
    pjsua_call_info CallInfo; pjsua_call_get_info(call_id, &CallInfo);
    unsigned MediaIndex; for (MediaIndex = 0; MediaIndex < CallInfo.media_cnt;MediaIndex++)
    {
        switch (CallInfo.media[MediaIndex].type)
        {
        case PJMEDIA_TYPE_AUDIO:
            pjsua_conf_connect(LV.PlayerConferencePortNo, CallInfo.media[MediaIndex].stream.aud.conf_slot);
        }
    }
}

Then I pick up my phone, dial the gateway, and (when it gives dial tone) dial this softphone.  No "PleaseLeaveYourMessage" plays, but I can here the softphone hang up on me when the timeout expires.

2: running /usr/bin/pjsip-test-arm-poky-linux-gnueabi -l 6 logs an error and quits.
    line 918060 of 918085.
        I can't tell where one test ends and another begins (hint/beg of benny: please number the tests and print out the number so I can say "test 4373 failed; it said "foobar" when it should have said "mumble", and we'd be on the same page together.
        Instead:
20:02:58.879 Sending Response msg 200/INVITE/cseq=47769 (tdta0xb8c510) in state Proceeding
20:02:58.879 .Destroying txdata Response msg 100/INVITE/cseq=47769 (tdta0xb93548)
20:02:58.879 .TX 321 bytes Response msg 200/INVITE/cseq=47769 (tdta0xb8c510) to LOOP-DGRAM:0.0.0.0:0:
SIP/2.0 200 OK^M
Via: SIP/2.0/LOOP-DGRAM 129.0.0.1:15060;rport=15060;received=129.0.0.1;branch=z9hG4bK-UAS-Test11^M
Call-ID: 82e44fbf-330c-4350-8d46-773a2226cba8^M
From: <sip:alice@127.0.0.1>;tag=d71eff2a-a70f-4e7c-9151-a3a8a2f5e2f4^M
To: <sip:bob at 127.0.0.1>;tag=z9hG4bK-UAS-Test11^M
CSeq: 47769 INVITE^M
Content-Length:  0^M
^M

--end msg--
20:02:58.879 .State changed from Proceeding to Completed, event=TX_MSG
20:02:58.930 Transport failed to send Response msg 200/INVITE/cseq=47769 (tdta0xb8c510)! Err=120104 (Connection reset by peer)
20:02:58.932 State changed from Completed to Terminated, event=TRANSPORT_ERROR
20:02:58.932     error: incorrect status code
20:02:58.932 Timeout timer event
20:02:58.932 .State changed from Terminated to Destroyed, event=TIMER
20:02:58.932 ..Destroying txdata Response msg 200/INVITE/cseq=47769 (tdta0xb8c510)
20:02:58.932 Transaction destroyed!
20:02:58.933 ..ERROR(-170)
________________________________
From: pjsip [pjsip-bounces@xxxxxxxxxxxxxxx] on behalf of Bill Gardner [billg at wavearts.com]
Sent: Monday, October 27, 2014 2:16 PM
To: pjsip at lists.pjsip.org
Subject: Re: How to play a "splash-tone" file as soon as posssible in the call sequence

See pjsua_app.c for example on how to create player and connect to conference when call answers. It's all part of the --auto-play option in pjsua.

On 10/27/2014 10:35 AM, Brunner, Brian T. wrote:
I'm puzzled why you need to see broken code in order to tell me correct code?

Given a call_id, how do I tell which conference port to connect to, in order to send a wav file to the caller?  So far I've managed to connect it to my sound hardware, which isn't much progress.

I'm curious which call-back is the earliest point in the call sequence wherein I'm able to tell which conference port to connect my player to (which I mentioned I'd created).

When we're agreed that my broken code is in the correct place (and therefore it is the code that is broken, not its location) lets look at broken code to see what I did wrong in the right place.

Is there an example of this process (I haven't found one yet)?
________________________________
From: pjsip [pjsip-bounces@xxxxxxxxxxxxxxx<mailto:pjsip-bounces at lists.pjsip.org>] on behalf of Bill Gardner [billg at wavearts.com<mailto:billg at wavearts.com>]
Sent: Friday, October 24, 2014 3:47 PM
To: pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>
Subject: Re: How to play a "splash-tone" file as soon as posssible in the call sequence

Creating a player and connecting to the conference should work, perhaps you can share some code?

On 10/24/2014 10:50 AM, Brunner, Brian T. wrote:

My attempts (which have been many and unsuccessful) lead me to beg:
How can my SoftVoIPPhone pick up the call and play a "splash tone" or "please leave your message after the tone" file from the hard drive to the caller?

I create a player, and I connect it to the conference, but clearly not the right way or right time.




________________________________
----------------------------------------------------------------------------------------------------------------------------
Confidentiality Requirement: This communication, including any attachment(s), may contain confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that you have received this communication in error and any unauthorized review, use, disclosure, dissemination, distribution or copying of it or its contents is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by telephone or e-mail and destroy all copies of this communication and any attachments.



_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org





_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org<mailto:pjsip at lists.pjsip.org>
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20141030/2789356f/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