Hello VoIP Geeks!

I am looking for a way to reroute calls on specific disconnect reasons. My
application is in Python. I will provide my solves so far, which for some
reason I cannot use. Why I need rerouting? Well, I am using the LCR module
which provides multiple routes per destination, like this:
routes=
[lcr_carrier=fs-rocks.com,lcr_rate=0.15000]sofia/default/[email protected]
:5062|
[lcr_carrier=fs-rocks.com,lcr_rate=0.16000]sofia/default/[email protected]
:5064

Solve 1: Python solve
Split the routes string to multiple routes. Bridge the call. Check if the
call failed and bridge again.

ivr_reroute_on=(\

    "CALL_REJECTED",\
    "CRASH",\
    "INVALID_NUMBER_FORMAT",\
    "NORMAL_TEMPORARY_FAILURE",\
    "NO_ROUTE_DESTINATION",\
    "NO_USER_RESPONSE",\

    "NUMBER_CHANGED",\

    "RECOVERY_ON_TIMER_EXPIRE",\

    "SERVICE_NOT_IMPLEMENTED",\

)       
...
session.execute("bridge", route)
hangup_cause = str(session.getVariable("originate_disposition"))
if hangup_cause in ivr_reroute_on:
 #bridge again
 ...
else:
 ...
 #do not bridge again

This is tested and works. However my manager does not likes it. I am not
commenting on the side effects of this code (i.e. if you have some
timers/schedules/scheduled events etc).

Solve 2: Freeswitch Source Code solve
Modify the source code of "switch_ivr_originate.c":

                                                if (to &&
!oglobals.continue_on_timeout) {
                                                                goto
outer_for;
                                                }
                                                after line 2523:

                                                +if
(switch_channel_cause2str(*cause) == SWITCH_CAUSE_CALL_REJECTED ) {
                                                +             goto
outer_for;
                                                +}

(In the best case I will add a new channel variable to Freeswitch to control
all the disconnect reasons from here) However my manager again does not
likes this. He says that I am not good enough in C/C++ to use this solution.

Solve 3: continue_on_fail
I have tried using the channel variable "continue_on_fail" which I believe
works only in the dialplan with no luck. I was unable to get it running both
in the dialplan and in Python. By the way I saw that "continue_on_fail" is
indeed implemented elsewhere, while "continue_on_timeout" is exactly in
"switch_ivr_originate.c" as expected.

Solve 4:
So can you please people recommend me any other solution? Any function or
variable to do the trick?

Thank you for your time and help!

Delian Tashev


_______________________________________________
FreeSWITCH-users mailing list
[email protected]
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

Reply via email to