[Freeswitch-users] Originating Calls, without knowing the endpoint URL?

Brian Wood bwood-lists at jacosoft.com
Tue Sep 2 13:20:43 PDT 2008


I'm experimenting with FreeSWITCH. I have a setup working with FXO, FXS, 
and SIP (to hardware and software phones, and gateways). I'd like to be 
able to place a new outgoing call and then do something, for example, 
play a message notifying me that the power has gone out.

I have been successful doing this through the event socket, XML-RPC, 
JavaScript, etc. However, I have to know the full endpoint URL. I've 
searched the list, wiki, web for examples. I've seen several attempts at 
an example, but no clear and complete example.

What I'd really like to be able to do is something like (JavaScript 
example):

    var s = new Session();
    s.originate(session, "1234567890");
    s.streamFile("test.wav");
   
Instead of:

    var s = new Session();
    s.originate(session, "sofia/internal/1000");
    s.streamFile("test.wav");

I would like to be able to originate a new session, and have FreeSWITCH 
lookup the endpoint. Transfer and bridge don't seem quite right, and 
exceute_extension seems to block (and require a existing session). I've 
looked at Session.Originate, but I can't seem to get it to do anything 
useful.

So far, about the only ideas I have are to either parse the dialplan 
myself, or use mod_xml_curl to fetch the dialplan from my own 
software/database/etc. Then I could query my external source for the 
endpoint URL. This seems like overkill, but I can't find anyway to 
lookup the endpoint URL or place a call without one.

I plan on adding more gateways and possibly T1 cards into the system, so 
I would prefer if FreeSWITCH could do the "routing", and my scripts not 
have to know what the endpoint is.

It seems like there should be a way to do this (or at least a way query 
the for the endpoint given an extension/number). Maybe I'm just looking 
at the problem the wrong way. Maybe the dialplan is the complete wrong 
place to be looking, since it can do a lot more than just specify an 
endpoint.

Is there any easy way to do this, or do I simply have to have a endpoint 
URL?

On a related note, on an OpenZAP channel, how can I tell FreeSWITCH to 
use any available FXO channel? I can dial out using 
openzap/1/1/1234567890. However, if I have a T1 board or X number of FXO 
ports, is there a way to tell it to automatically use any available 
channel in a endpoint URL?

Thanks.




More information about the FreeSWITCH-users mailing list