[Freeswitch-dev] Freeswitch and Google PUSH (C2DM)
Nacho
leucaruth at gmail.com
Mon Jul 18 16:20:03 MSD 2011
Hi again.
I'm having a little problem with the Java ESL.
I can do some basic things like answer the call, subscribe to events, put
music in the caller... Thought I have som questions about API commands.
The flow right now in my program is this one:
- I begin listenning at port 8084 for ESL events
- If I receive an event with the name "channel_data" I begin the
iteration
- I answer the call with *sendMsg, addcallcommand("execute")
and addExecuteAppName("answer");*
- I subscribe to all events for debuging, I just use *EslMessage response
= sendSyncSingleLineCommand(channel, "event text all");*
- I put a tone on the caller with *sendMsg, addcallcommand("execute")
and addExecuteAppName("playback");*
- Now here is a tricky part, I send a petition with HttpURLConnection to
an APP server, this server is the one that controls the C2DM stuff, he
answers me when he sends the push and I continue the flow, but still have to
wait for the legB to connect to the freeswitch server
- I have to control when the legB gets connected to freeswitch, this is
something i have to work on, i don't want to be making continuous requests
to freeswitch to avoid overloading, so right now I assume legB is connected
by default.
- It's time to originate the call, so I send *sendMsg,
addcallcommand("execute"), addExecuteAppName("set")
and addExecuteAppArg("{ignore_early_media='true'}sofia/internal/1002%10.166.108.139");
* . *I'm using a default destiny for testing*
- I have just tested that this also works *EslMessage response =
sendSyncSingleLineCommand(channel, "api originate
{ignore_early_media='true'}sofia/internal/1002%10.166.108.139"); *
- And finally I bridge the call with SendMsg,
addCallCommand("execute"), addExecuteAppName("bridge"),
addExecuteAppArg("sofia/internal/1002%10.166.108.139")
and addEventLock();
This works well, but right now my major issue is knowing when the legB gets
connected to freeswitch so I can begin originating the call, but I have some
questions that I would like to know the answer too:
- The execute messages are for APP so they work like in the dialplan
<action> field, I saw somewhere that to see the complete list one should
look in the dialplan.xml, but I haven't found anything about a complete list
:S
- Things can be accomplished with API calls too, but I just dont get why
I have to use "api" before "originate" to make a call, but not needing it
for the events, it's a little confusing to use API commands like this, is
there any simpler way to do it?
- This makes my last question, is there any way to make freeswitch tell
me when someone registers in the server or do I need to be continuosly
asking freeswith with an API command if it is connected
Thinks are going well, I have to begin working with the android client next
to be able to process the C2DM messages, right now im using a default voip
client.
Sorry for the long post and thanks for your attention.
Regards
Jose
P.S: Again, thanks to davidv for making possible the use of a Java ESL
client :)
2011/7/11 Nacho <leucaruth at gmail.com>
> Cool, thanks for the tip David, I'm using your library and have it working.
>
> The wiki should advice about the SWIGed library and it's problems with Java
> and outbound connections.
>
> In a few days I will have news about the my progress.
>
> Regards,
>
> Jose
>
> 2011/7/11 david varnes <david.varnes at gmail.com>
>
>> Jose,
>>
>> If you want to use Java and ESL there are other alternatives
>> than the SWIGed library.
>>
>> http://wiki.freeswitch.org/wiki/Java_ESL
>>
>> I maintain the one here http://wiki.freeswitch.org/wiki/Java_ESL_Client
>>
>> I have a few pending changes that I want to commit for a new
>> release, but the existing release is stable.
>>
>> hope this helps
>> davidv
>>
>> On 11 July 2011 00:12, Nacho <leucaruth at gmail.com> wrote:
>> > I just noticed short before you answered :).
>> > I have been reading it and I found it very interesting, but I have found
>> a
>> > problem in Java.
>> > The constructor for an Outbound connection requires the File Descriptor
>> (an
>> > Int parameter) of the listening socket to create the ESL object, but as
>> far
>> > as I know, Java doesn't allow to get the int value of a File Descriptor
>> from
>> > a Socket. This would be veary easy to achieve in C, but I have no found
>> any
>> > means to get this to work with Java in Linux (Windows is out of the
>> > question).
>> > I tried to see the source code of the ESL client to see how it uses the
>> int
>> > value, but as I suspected is C code wrapped with SWIG. I have thought
>> about
>> > other ways to work with it, like using the FileDescriptor class in java
>> and
>> > Reflection, but I have not found any way to get the desired int value,
>> so
>> > i'm stuck about what to do right now.
>> > Any ideas? if the constructor requires the int value of the File
>> Descriptor
>> > means that there is a way to get it, doesn't it?
>> > Regards,
>> > Jose
>> >
>> > 2011/7/7 Kristian Kielhofner <kris at kriskinc.com>
>> >>
>> >> http://wiki.freeswitch.org/wiki/Event_Socket_Library
>> >>
>> >> On Thu, Jul 7, 2011 at 7:35 AM, Nacho <leucaruth at gmail.com> wrote:
>> >> > Hi again
>> >> > Im doing as Kristian suggested, at first is an easier solution that
>> >> > making a
>> >> > module.
>> >> > I created a plan that redirects calls to a local port where I will do
>> >> > the
>> >> > testings with the server that will work with that call.
>> >> > The call is parked and the connection is stablished as I can see with
>> >> > netcat, so I was thinking about making a program with C or Java that
>> >> > will
>> >> > become the custom server. The problem is that I don't find info about
>> >> > the
>> >> > structure of the packages I'll receive from Freeswitch, how to deal
>> with
>> >> > them or even how can I send orders to freeswitch.
>> >> > Any suggestions about where I could find some info about it would be
>> >> > kindly
>> >> > appreciated.
>> >> > Regards,
>> >> > Jose.
>> >> > 2011/7/6 Robert-iPhone <rhuddleston at gmail.com>
>> >> >>
>> >> >> I have interest too! Considering mwi / voicemail push for apple
>> >> >>
>> >> >> Sent from my iPhone
>> >> >>
>> >> >> On Jul 5, 2011, at 5:49 PM, Anthony Minessale
>> >> >> <anthony.minessale at gmail.com> wrote:
>> >> >>
>> >> >> > it can be left out of FS code but still part of contrib if an
>> >> >> > external
>> >> >> > solution is developed.
>> >> >> >
>> >> >> >
>> >> >> > On Tue, Jul 5, 2011 at 1:20 PM, Kristian Kielhofner
>> >> >> > <kris at kriskinc.com>
>> >> >> > wrote:
>> >> >> >> Jose,
>> >> >> >>
>> >> >> >> Whether it's C2DM or APNS (Apple) this functionality is best
>> left
>> >> >> >> out of FreeSWITCH. FreeSWITCH has plenty of other existing means
>> >> >> >> (XML_CURL, socket, etc) to drive dynamic call functionality and
>> >> >> >> interact with other technologies.
>> >> >> >>
>> >> >> >> How do you ask? An imcoming call to FreeSWITCH could hit static
>> >> >> >> dialplan and execute a socket connection to some other custom
>> >> >> >> server.
>> >> >> >> This server could tell FreeSWITCH to do something (play media,
>> >> >> >> ringback, messages, whatever) while it sends a PUSH (via C2DM or
>> >> >> >> APNS,
>> >> >> >> for example).
>> >> >> >>
>> >> >> >> One could implement such a socket program easily. It can be
>> >> >> >> extended and maintained separately as new push technologies
>> become
>> >> >> >> available.
>> >> >> >>
>> >> >> >> On Mon, Jul 4, 2011 at 7:48 AM, Nacho <leucaruth at gmail.com>
>> wrote:
>> >> >> >>> Hello all.
>> >> >> >>> My name is Jose. This is my first post here. I joined the list
>> >> >> >>> because
>> >> >> >>> I was
>> >> >> >>> wondering about developing a feature for Freeswitch and I would
>> >> >> >>> like
>> >> >> >>> to know
>> >> >> >>> your opinion.
>> >> >> >>> The idea is about making a non-persistent client for cell phones
>> >> >> >>> that
>> >> >> >>> works
>> >> >> >>> with PUSH technology (C2DM and Android for example). These
>> clients
>> >> >> >>> wouldn't
>> >> >> >>> be connected to the Freeswitch server at first, but if there is
>> an
>> >> >> >>> incoming
>> >> >> >>> call, the Freeswitch server would send a PUSH message to these
>> >> >> >>> clients, the
>> >> >> >>> client would process it and, if accepted by the user, the client
>> >> >> >>> would
>> >> >> >>> awake, connect to Freeswitch and then receive the the call
>> invite
>> >> >> >>> message
>> >> >> >>> and accept it automatically.
>> >> >> >>> I don't know if this idea is plausible due to the real time
>> >> >> >>> restrictions we
>> >> >> >>> have to face in phone calls. If the delay introduced by C2DM
>> >> >> >>> delivery
>> >> >> >>> is
>> >> >> >>> high, the waiting time for the caller is probably something that
>> he
>> >> >> >>> isn't
>> >> >> >>> willing to accept in order to get his call answered.
>> >> >> >>> Another question is about the battery life time it would save
>> >> >> >>> because
>> >> >> >>> the
>> >> >> >>> application woulnd't need to be answering the "still alive" ACKS
>> >> >> >>> from
>> >> >> >>> Freeswitch.
>> >> >> >>> I'm new in freeswitch developing and still learning about it,
>> but
>> >> >> >>> I'm
>> >> >> >>> really
>> >> >> >>> interested in this, so any help would be kindly appreciated.
>> >> >> >>> --
>> >> >> >>> Aquellos que hablan son esclavos de sus palabras y los que
>> callan
>> >> >> >>> dueños de
>> >> >> >>> su silencio.
>> >> >> >>>
>> >> >> >>> _______________________________________________
>> >> >> >>> Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> >> >>> http://www.cluecon.com 877-7-4ACLUE
>> >> >> >>>
>> >> >> >>> FreeSWITCH-dev mailing list
>> >> >> >>> FreeSWITCH-dev at lists.freeswitch.org
>> >> >> >>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> >> >>>
>> >> >> >>> UNSUBSCRIBE:
>> http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> >> >>> http://www.freeswitch.org
>> >> >> >>>
>> >> >> >>>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Kristian Kielhofner
>> >> >> >>
>> >> >> >> _______________________________________________
>> >> >> >> Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> >> >> http://www.cluecon.com 877-7-4ACLUE
>> >> >> >>
>> >> >> >> FreeSWITCH-dev mailing list
>> >> >> >> FreeSWITCH-dev at lists.freeswitch.org
>> >> >> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> >> >>
>> >> >> >> UNSUBSCRIBE:
>> http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> >> >> http://www.freeswitch.org
>> >> >> >>
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Anthony Minessale II
>> >> >> >
>> >> >> > FreeSWITCH http://www.freeswitch.org/
>> >> >> > ClueCon http://www.cluecon.com/
>> >> >> > Twitter: http://twitter.com/FreeSWITCH_wire
>> >> >> >
>> >> >> > 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
>> >> >> > googletalk:conf+888 at conference.freeswitch.org
>> >> >> > pstn:+19193869900
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> >> > http://www.cluecon.com 877-7-4ACLUE
>> >> >> >
>> >> >> > FreeSWITCH-dev mailing list
>> >> >> > FreeSWITCH-dev at lists.freeswitch.org
>> >> >> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> >> >
>> >> >> > UNSUBSCRIBE:
>> http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> >> > http://www.freeswitch.org
>> >> >>
>> >> >> _______________________________________________
>> >> >> Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> >> http://www.cluecon.com 877-7-4ACLUE
>> >> >>
>> >> >> FreeSWITCH-dev mailing list
>> >> >> FreeSWITCH-dev at lists.freeswitch.org
>> >> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> >> UNSUBSCRIBE:
>> http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> >> http://www.freeswitch.org
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Aquellos que hablan son esclavos de sus palabras y los que callan
>> dueños
>> >> > de
>> >> > su silencio.
>> >> >
>> >> > _______________________________________________
>> >> > Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> > http://www.cluecon.com 877-7-4ACLUE
>> >> >
>> >> > FreeSWITCH-dev mailing list
>> >> > FreeSWITCH-dev at lists.freeswitch.org
>> >> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> > UNSUBSCRIBE:
>> http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> > http://www.freeswitch.org
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Kristian Kielhofner
>> >>
>> >> _______________________________________________
>> >> Join us at ClueCon 2011, Aug 9-11, Chicago
>> >> http://www.cluecon.com 877-7-4ACLUE
>> >>
>> >> FreeSWITCH-dev mailing list
>> >> FreeSWITCH-dev at lists.freeswitch.org
>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> >> http://www.freeswitch.org
>> >
>> >
>> >
>> > --
>> > Aquellos que hablan son esclavos de sus palabras y los que callan dueños
>> de
>> > su silencio.
>> >
>> > _______________________________________________
>> > Join us at ClueCon 2011, Aug 9-11, Chicago
>> > http://www.cluecon.com 877-7-4ACLUE
>> >
>> > FreeSWITCH-dev mailing list
>> > FreeSWITCH-dev at lists.freeswitch.org
>> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> > http://www.freeswitch.org
>> >
>> >
>>
>>
>>
>> --
>> david varnes
>>
>> e: david.varnes at gmail.com
>> p: +61 404 925 633
>>
>
>
>
> --
> Aquellos que hablan son esclavos de sus palabras y los que callan dueños de
> su silencio.
>
--
Aquellos que hablan son esclavos de sus palabras y los que callan dueños de
su silencio.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20110718/5ff6a3e5/attachment-0001.html
More information about the FreeSWITCH-dev
mailing list