[Freeswitch-users] Did the call connect?

Jonas Gauffin jonas.gauffin at gmail.com
Tue Aug 19 06:40:50 PDT 2008


I had the same problem a while ago. I don't know if it's fixed, but I
do this (and it works)

				session.setVariable("ringback", "%(1000,4000,425)");
				bleg = new Session();
				bleg.setCallerData("caller_id_name", session.caller_id_name);
				bleg.setCallerData("caller_id_num", session.caller_id_num);
				log.debug("Calling sofia/" + options[2] + "/" + options[3] + " for
" + options[1] + " seconds");
				timeOut = parseInt(options[1]);
				destination =
"{ignore_early_media=true,originate_timeout=10}sofia/mydomain.com/" +
options[3] + "%" + options[2];
				log.debug("DESTINATION: " + destination + " waiting 15 secs");
				res = bleg.originate(session, destination);
				
				if (res) {
					res2 = bleg.waitForAnswer(20000);
					res2 = session.waitForAnswer(20000);
				}
				else
					res2 = false;
				
				log.debug("**** Originate result: " + res + ", " + res2 + " ************");
				if (res)
				{
					log.debug("Transferred");
					socket.send("transfer\tok\n");
					bridge(session, bleg);
					exit();
				}
				else
					socket.send("transfer\tfailed\n");

On Tue, Aug 19, 2008 at 3:36 PM, James Green <james.green at stealthnet.net> wrote:
> Taking the following code:
>
> new_session.originate(session, dialout);
> new_session.waitForAnswer(20000);
>
> At this point either the call connected or we timed out.
>
> I expected to be able to use new_session.ready() to determine if the
> call successfully answered but this also returns true if the call timed
> out. The circumstances in which it will return false are not documented
> on the wiki.
>
> session.ready() is apparently not a function.
>
> So how does one check that the originate() ended up with a connected call?
>
> Thanks again,
>
> James
>
> _______________________________________________
> Freeswitch-users mailing list
> Freeswitch-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>




More information about the FreeSWITCH-users mailing list