[Freeswitch-users] 2 SIP Lines, Difficulty Originating Call
Chris Danielson
chris at maxpowersoft.com
Sat Sep 8 09:36:54 PDT 2007
I attempted the session.streamFile(...) and was able to successfully
hear the wav file. I also attempted calling the session.answer() for a
second time within the cf_bridge_call function. Still, I am unable to
hear the ringing sound even though the phone that I called is actually
ringing. When the phone is answered, the originate appears to fail due
to a 60 second timeout, which is reported as a NO_ANSWER. This happens
regardless of whether or not the phone I am calling is answered or not.
Here is the current execution flow within my Javascript:
function cf_bridge_call(phone) {
var str = "sofia/gateway/line2/"+phone;
session.setVariable("ringback", "%(2000, 4000, 440.0, 480.0)");
session.preAnswer(); /* attemped a session.answer() here in another
test. The sound file still played, not no ringing was heard. */
session.streamFile("/usr/local/freeswitch/sounds/you_rang.wav");
session.execute("bridge", str);
}
session.answer();
session.flushDigits();
/**
* Query database and dynamically load a phone number into variable
**/
var phoneNo = db_get_phone();
cf_bridge_call(phoneNo);
The log output was:
2007-09-08 01:54:35 [DEBUG] switch_ivr_play_say.c:1007
switch_ivr_play_file() done playing file
2007-09-08 01:54:35 [NOTICE] switch_channel.c:385
switch_channel_set_name() New Chan sofia/sip.vonics.net/18881234567
[1f766c60-5de9-11dc-af73-3b3c22977fdb]
2007-09-08 01:54:35 [DEBUG] mod_sofia.c:1431 sofia_outgoing_channel()
sofia/sip.vonics.net/18881234567 State Change CS_NEW -> CS_INIT
2007-09-08 01:54:35 [DEBUG] switch_core_session.c:647
switch_core_session_signal_state_change() Kill
sofia/sip.vonics.net/18881234567 [BREAK]
2007-09-08 01:54:35 [DEBUG] switch_core_state_machine.c:383
switch_core_session_run() (sofia/sip.vonics.net/18881234567) State INIT
2007-09-08 01:54:35 [DEBUG] mod_sofia.c:92 sofia_on_init() SOFIA INIT
2007-09-08 01:54:35 [DEBUG] sofia.c:71 sofia_event_callback() event
[nua_i_state] status [0][INVITE sent] session:
sofia/sip.vonics.net/18881234567
2007-09-08 01:54:35 [DEBUG] sofia.c:1028 sofia_handle_sip_i_state()
Channel sofia/sip.vonics.net/18881234567 entering state [calling]
2007-09-08 01:54:35 [DEBUG] mod_sofia.c:105 sofia_on_init()
sofia/sip.vonics.net/18881234567 State Change CS_INIT -> CS_RING
2007-09-08 01:54:35 [DEBUG] switch_core_session.c:647
switch_core_session_signal_state_change() Kill
sofia/sip.vonics.net/18881234567 [BREAK]
2007-09-08 01:54:35 [DEBUG] switch_core_state_machine.c:418
switch_core_session_run() (sofia/sip.vonics.net/18881234567) State RING
2007-09-08 01:54:35 [DEBUG] mod_sofia.c:120 sofia_on_ring() SOFIA RING
2007-09-08 01:54:35 [DEBUG] switch_ivr_originate.c:48
originate_on_ring() sofia/sip.vonics.net/18881234567 State Change
CS_RING -> CS_HOLD
2007-09-08 01:54:35 [DEBUG] switch_core_session.c:647
switch_core_session_signal_state_change() Kill
sofia/sip.vonics.net/18881234567 [BREAK]
2007-09-08 01:54:35 [DEBUG] switch_core_state_machine.c:596
switch_core_session_run() (sofia/sip.vonics.net/18881234567) State HOLD
2007-09-08 01:54:35 [DEBUG] switch_core_state_machine.c:204
switch_core_standard_on_hold() Standard HOLD
2007-09-08 01:54:35 [DEBUG] switch_ivr_originate.c:619
switch_ivr_originate() Raw Codec Activation Success L16 at 8000hz 1 channel
20ms
2007-09-08 01:54:35 [DEBUG] switch_ivr_originate.c:667
switch_ivr_originate() Play Ringback Tone [%(2000, 4000, 440.0, 480.0)]
2007-09-08 01:54:35 [DEBUG] sofia.c:71 sofia_event_callback() event
[nua_r_invite] status [401][Unauthorized] session:
sofia/sip.vonics.net/18881234567
2007-09-08 01:54:35 [DEBUG] sofia_reg.c:691
sofia_reg_handle_sip_r_challenge() Authenticating 'FreeSWITCH' with
'Digest:"sip.vonics.net":16191111111:5874'.
2007-09-08 01:54:35 [DEBUG] sofia.c:71 sofia_event_callback() event
[nua_i_state] status [0][INVITE sent] session:
sofia/sip.vonics.net/18881234567
2007-09-08 01:54:35 [DEBUG] sofia.c:1028 sofia_handle_sip_i_state()
Channel sofia/sip.vonics.net/18881234567 entering state [calling]
2007-09-08 01:55:35 [NOTICE] switch_ivr_originate.c:805
switch_ivr_originate() Hangup sofia/sip.vonics.net/18881234567 [CS_HOLD]
[NO_ANSWER]
2007-09-08 01:55:35 [DEBUG] switch_channel.c:1076
switch_channel_perform_hangup() Kill sofia/sip.vonics.net/18881234567 [KILL]
2007-09-08 01:55:35 [DEBUG] switch_core_session.c:647
switch_core_session_signal_state_change() Kill
sofia/sip.vonics.net/18582718005 [BREAK]
2007-09-08 01:55:35 [DEBUG] switch_ivr_originate.c:878
switch_ivr_originate() Originate Cancelled by originator termination
Cause: 19 [NO_ANSWER]
2007-09-08 01:55:35 [INFO] mod_dptools.c:1087 audio_bridge_function()
Originate Failed. Cause: NO_ANSWER
Thanks again for all the help.
Kind Regards,
Chris Danielson
Anthony Minessale wrote:
> you can find out by playing a file in the script
> to make sure you have an audio path.
>
> session.preAnswer();
> session.streamFile("/some.wav");
>
> If that doesn't work the inbound device may not support early media so
> try session.answer(); instead to compare what happens when you send a
> 200 ok instead of a 183 progress
>
>
>
> Anthony Minessale II
>
> FreeSWITCH http://www.freeswitch.org/
> ClueCon http://www.cluecon.com/
>
> AIM: anthm
> MSN:anthony_minessale at hotmail.com
> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
> IRC: irc.freenode.net #freeswitch
>
> FreeSWITCH Developer Conference
> sip:888 at conference.freeswitch.org
> iax:guest at conference.freeswitch.org/888
> googletalk:conf+888 at conference.freeswitch.org
> pstn:213-799-1400
>
>
> ----- Original Message ----
> From: Chris Danielson <chris at maxpowersoft.com>
> To: freeswitch-users at lists.freeswitch.org
> Sent: Thursday, September 6, 2007 11:50:29 PM
> Subject: Re: [Freeswitch-users] 2 SIP Lines, Difficulty Originating Call
>
> Thanks again for all the help. My apologies for not replying sooner,
> I was out of town for a week and needed some extra time to research
> and try some of the things you had mentioned. Everything that is
> brought up in this thread will get documented by me within the wiki.
>
> So far I have tried both techniques within my JavaScript code that
> Anthony mentioned. Here is one example:
>
> function cf_bridge_call(phone) {
> var str = "sofia/gateway/line2/"+phone;
> session.setVariable("ringback", "%(2000, 4000, 440.0, 480.0)");
> session.preAnswer();
> session.execute("bridge", str);
> }
> cf_bridge_call("18881234567");
>
> When I make this call I still do not hear the ringing and notice that
> the console renders:
> nta: received 180 Ringing for INVITE (87950735)
> nta: 180 Ringing was discarded
>
> When the phone is actually answered, I still cannot hear the person on
> the other side speaking too.
>
> Is this possibly due to the fact that I am having a NAT issue? Or
> could this be that my carrier is doing something out of the norm? And
> finally, should I implement this strictly as a dialplan within the
> default_context.xml file and avoid handling this functionality within
> JavaScript?
>
> Kind Regards,
> Chris Danielson
>
> Anthony Minessale wrote:
>> You should choose one or the other not both.
>> One is inband ringing generated by FreeSWITCH and the other
>> is just the sip message telling the phone to indicate ringinig.
>> Here is a description I wrote on an earlier posting here that someone
>> may want to stick in the wiki.
>>
>> ---snip
>>
>> ring_ready is a dialplan application that sends the protocol specific
>> message to indicate ringing. In the case of SIP a 180 Ringing.
>>
>> ringback is a channel variable you can set to artificially generate a
>> tone or play an audio file to an originating channel while it waits
>> to be connected to another call.
>>
>> pre_answer is a dialplan application that will send the protocol
>> specific message to indicate early media. In the case of SIP a 183
>> Progress
>>
>> So, if you call into freeswitch with sip and the first entry in your
>> dialplan is ring_ready followed by a bridge to some other destination
>> when it hits ring_ready it will send "180 Ringing" back to your phone
>> so it can generate the ringing sound.
>>
>> If instead you use the set application to set ringback to a tone spec
>> or audio file followed by a call to pre_answer to establish an early
>> media connection followed by a call to bridge to another dest, then
>> the core will generate this audio locally and send it back to your
>> phone. Again, this occurs during early media meaning the call has not
>> been answered but the SIP has negotiated a media path in advance for
>> this type of pre-answer audio indication. SIP has no promise that
>> early media must be supported so some switches and devices opt to not
>> support it meaning you may not be able to hear any audio until the
>> call is officially answered which would keep you from hearing the
>> artificial ringback at all.
>>
>>
>>
>>
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> iax:guest at conference.freeswitch.org/888
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:213-799-1400
>>
>>
>> ----- Original Message ----
>> From: Tamas Cseke <cstomi.levlist at gmail.com>
>> To: chris at maxpowersoft.com; freeswitch-users at lists.freeswitch.org
>> Sent: Monday, August 27, 2007 2:34:22 AM
>> Subject: Re: [Freeswitch-users] 2 SIP Lines, Difficulty Originating Call
>>
>> Chris Danielson írta:
>> > If any one can help me, I am having two issues. Basically, while my
>> > javascript is executing a single inbound SIP call the script
>> > conditionally gets to a point where the end-user can originate a
>> call to
>> > an external phone number. Keep in mind that I have two sip lines
>> > defined as gateways supplied by my carrier vonics.net. Upon
>> calling the
>> > originate method, the call is actually placed and the destination
>> phone
>> > actually begins to ring. At this point I still cannot hear the
>> ringing
>> > on the original session that was originated by my inbound call. Also,
>> > the originate method times out regardless of whether or not the
>> > destination "phone" number was answered or not.
>> >
>> > So my two issues are:
>> > 1) Why does the originate method start a call, the destination phone
>> > called actually rings, but always times out, regardless of whether or
>> > not the phone was answered?
>> > 2) When calling the originate method, I never hear the phone
>> ringing on
>> > my inbound connection.
>> >
>> You should call ring_ready app, if you want to hear the ringing afaik.
>>
>> /* set ringback tone */
>> session.setVariable("ringback", "%(2000, 4000, 440.0,
>> 480.0)");
>> session.execute("ring_ready", "");
>>
>> I found these pages, maybe you can find more about it on wiki.
>> http://wiki.freeswitch.org/wiki/Custom_Ring_Back_Tones
>> http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_ring_ready
>>
>> Hope this help!
>>
>> Regards,
>> Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20070908/8573f245/attachment-0002.html
More information about the FreeSWITCH-users
mailing list