Quantcast

howto originate fs call from webapp (python)

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

howto originate fs call from webapp (python)

Alexander de Greiff
hi all,

i come from asterisk an i am new to freeswitch. after my with days with freeswitch i am very excited!

but trying to migrate our deployment i have three challenges. one of them is:

i need to call freeswitch from a webapp (e.g. python) and pass number1 and number2. i then need freeswitch to call number1. as soon as it is picked up say a short confirmaton text, call number2 and bridge the two.

my first approach was to call via xml_rpc like described in the wiki but when i call like

 server.freeswitch.api("originate","sofia/gategay/gateway1/{number1} &bridge(sofia/gateway/gateway2/{number2})")

but in this case both numbers are called in parallel and the first number to pick up gets a ringback tone until the other number picks up. how can i get the sequence described above?

thanks for your help
alex

_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto originate fs call from webapp (python)

Rupa Schomaker (lists)-3
> my first approach was to call via xml_rpc like described in the wiki
> but when i call like
>
> server.freeswitch.api("originate","sofia/gategay/gateway1/{number1}
> &bridge(sofia/gateway/gateway2/{number2})")
>
> but in this case both numbers are called in parallel and the first
> number to pick up gets a ringback tone until the other number picks
> up. how can i get the sequence described above?
>
> thanks for your help alex

You are probably getting early media when dialing number 1.  Try :

 server.freeswitch.api("originate","{ignore_early_media=true}sofia/gategay/gateway1/{number1}
 &bridge(sofia/gateway/gateway2/{number2})")


_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto originate fs call from webapp (python)

mercutioviz
In reply to this post by Alexander de Greiff
On Tue, Feb 24, 2009 at 1:09 PM, Alexander de Greiff
<[hidden email]> wrote:
> hi all,
>
> i come from asterisk an i am new to freeswitch. after my with days with freeswitch i am very excited!

Welcome to FreeSWITCH!

>
> but trying to migrate our deployment i have three challenges. one of them is:
>
> i need to call freeswitch from a webapp (e.g. python) and pass number1 and number2. i then need freeswitch to call number1. as soon as it is picked up say a short confirmaton text, call number2 and bridge the two.
>
> my first approach was to call via xml_rpc like described in the wiki but when i call like
>
>  server.freeswitch.api("originate","sofia/gategay/gateway1/{number1} &bridge(sofia/gateway/gateway2/{number2})")
>
> but in this case both numbers are called in parallel and the first number to pick up gets a ringback tone until the other number picks up. how can i get the sequence described above?
>
> thanks for your help
> alex

Do you have any other requirements? For example, what happens if the
first bridge fails? Does your Python app need to "do anything"? Just
curious.

Thanks,
MC

_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto originate fs call from webapp (python)

Alexander de Greiff
In reply to this post by Alexander de Greiff
hi,

oops, i must have been very tired when i wrote my first mail to the list...

thanks for your replies. {ignore_early_media=true} really worked for me.

i try very hard to "unlearn" asterisk.

with asterisk i did not do much more with the python script, but i would like the pthon script to interact more with freeswitch like:

- call number1
- say a welcome message with cepstral voice
- call number2
- bridge


other scenario:

enter telephone number in webapp
python script have fs to call number
say "please enter the pin code from the website"
validate dtmf code
pass back to webapp: correct or not correct

unfortunately just from reading the wiki i don't know how to do it in my python script.

can you share your experience?

thanks
alex

_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto originate fs call from webapp (python)

Anthony Minessale
from the freeswitch build root <the place you type make install from>
cd libs/esl

if you have python-devel or the equiv

make pymod
from there if you cd python you will see a python module you can use to control freeswitch.


On Wed, Feb 25, 2009 at 2:30 AM, Alexander de Greiff <[hidden email]> wrote:
hi,

oops, i must have been very tired when i wrote my first mail to the list...

thanks for your replies. {ignore_early_media=true} really worked for me.

i try very hard to "unlearn" asterisk.

with asterisk i did not do much more with the python script, but i would like the pthon script to interact more with freeswitch like:

- call number1
- say a welcome message with cepstral voice
- call number2
- bridge


other scenario:

enter telephone number in webapp
python script have fs to call number
say "please enter the pin code from the website"
validate dtmf code
pass back to webapp: correct or not correct

unfortunately just from reading the wiki i don't know how to do it in my python script.

can you share your experience?

thanks
alex



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
[hidden email]
GTALK/JABBER/[hidden email]
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
[hidden email]
iax:guest@.../888
[hidden email]
pstn:213-799-1400

_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: howto originate fs call from webapp (python)

mercutioviz
In reply to this post by Alexander de Greiff
> enter telephone number in webapp
> python script have fs to call number
> say "please enter the pin code from the website"
> validate dtmf code
> pass back to webapp: correct or not correct
>
> unfortunately just from reading the wiki i don't know how to do it in my python script.
>
> can you share your experience?

You definitely need to become familiar with the event socket. However,
to become familiar with the event socket you need also to become
familiar with some of the basic FreeSWITCH API functions, like "bgapi"
and "originate" as well as what kinds of events come over the event
socket.

Here is some recommended reading:
#1 - The reporting bugs page on the wiki. It may sound crazy, but I
promise you that if you at least skim over it then it will save you
time when you start having to debug things.
http://wiki.freeswitch.org/wiki/Reporting_Bugs

#2 - The event socket page on the wiki:
http://wiki.freeswitch.org/wiki/Mod_event_socket

#3 - The commands page on the wiki. Pay special attention to the
"originate," "bridge," and "bgapi" commands because they will be
extremely useful to you in your application:
http://wiki.freeswitch.org/wiki/Mod_commands

#4 - The Asterisk/FreeSWITCH Rosetta Stone wiki page. In some cases
you can leverage your Asterisk knowledge. This page gives you some
tips on how to do stuff in FS that you already know how to do with
Asterisk:
http://wiki.freeswitch.org/wiki/Rosetta_stone

You have lots of reading to do! :) You will also need to start doing
test phone calls. Make test calls and see how things work. Watch the
debug information on the CLI to see what FS is doing with each call.
It's very interesting.

Join us on IRC when you have questions and want to talk in real-time.
-MC (IRC: mercutioviz)

_______________________________________________
Freeswitch-users mailing list
[hidden email]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Loading...