how to originate a call with freeswitch esl?

4.4k views Asked by At

im trying to do the simplest outgoing call to a simple phone number with esl. but nothing seems to work

i get incoming events and i can issue different commands (answer,conference) etc. but originate simply doesnt do a thing

most online info has loads of different options that are at the moment unimportant for me. for now i just need to get the call out. i guess i can always add additional options later.

heres the stripped down code (im trying different versions)

SwitchApi("originate", "sofia/external/[email protected]")
SwitchApi("originate", "sofia/external/[email protected]")
SwitchApi("originate", "sofia/external/17181112222")

Function SwitchApi(Command As String, Arg As String) As ESLevent
    Dim esl = FreeSwitch.Api(Command, Arg)
    Return esl
End Function

ive also tried freeswitch.api and freeswitch.bgapi if it makes any difference

all these calls and some others ive tried return something like

-USAGE: <'call url> <'exten>|&<'application_name>(<'app_args>) [<'dialplan>] [<'context>] [<'cid_name>] [<'cid_num>] [<'timeout_sec>]

also they dont even show up in the freeswitch log

any help is greatly appreciated

thanks!

SOLUTION

this is the line that works

SwitchApi("originate", "sofia/gateway/mygateway/1718111222 &park()")
1

There are 1 answers

1
Stanislav Sinyagin On BEST ANSWER

well, the error message is completely correct: the originate API needs an application to execute on the outbound call. This could be &playback() or &park() or something else.

See some working examples in my scripts on github: