[Freeswitch-users] ESL: not bein able to determine when SIP gateway is down when originating a call

Anton VG anton.vazir at gmail.com
Sat May 14 21:17:12 MSD 2011


I'm trying to catch an error, in case I would dial wrong (non
existent) gateway (intentionally!)

I'm running ESL outbound listener, subscribing to all events,
if I do bgapi 'originate' to a live gateway - there are normal events
flow, and I
can track what is happening.
But if I issue originate to a gateway, which is not configured or
simply down - there
are no any events fired.

I only have an error on FS console

2011-05-14 20:58:13.072927 [ERR] mod_sofia.c:4044 Invalid Gateway
following by
2011-05-14 20:58:13.072927 [ERR] switch_ivr_originate.c:2447 Cannot
create outgoing channel of type [sofia] cause: [INVALID_NUMBER_FORMAT]

But HOW to catch the given in ESL?

sofia.c seems just does not have event code for that cases

if (profile_name && !profile_found) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No Such
Profile '%s'\n", profile_name);
>status = SWITCH_STATUS_FALSE;
}

logically there should be a proper way to determine that gateway is bad in my
ESL dialplan, by catching the proper event/reply/whatever,
For the moment i did trick: esl.api('sofia status gateway
GatewayWhichIsDown')

When in production, and there is more than a single route, there will
be plenty of cases, when you dial a bad gateway, so there should be a
way for ESL dialplan to determine that a gateway is not callable for a
moment, the reason WHY and  to retry with another one.

The trick above is bad, since:
1. blocking api query, before evey single gateway call attempt.
2. Gateway maybe known in UP state, but the state is stale, in dial in
fact will go to DOWN gateway. So, ESL dialplan will screw in that case

Any clue?



More information about the FreeSWITCH-users mailing list