[Freeswitch-users] FS -How to identify the A-leg or B-leg inside the source code

fieldpeak fieldpeak at gmail.com
Sun Oct 16 07:41:32 MSD 2011


Hi Friends,

i'm using mod_nibblebill for billing on FS, i bundled event processing
fucntions when status change,
e.g. /* on_routing */ check_billing_before_routing,
and * on_hangup */ process_hangup, as below,
however, i found it excuted the processing function on both A-leg and
B-leg, what i want is that either only A-leg or only B-leg (i can
select by coding), how can i realize it?

P.S. is it possible that i identify the Legs (A or B) inside the
processing function (e.g. check_billing_before_routing,) by intput
parameter *sessionsession?


source codes as below,

switch_state_handler_table_t nibble_state_handler = {
	/* on_init */ NULL,
	/* on_routing */ check_billing_before_routing, /* Need to add a check
here for anything in their account before routing */
	/* on_execute */ sched_billing, 	/* Turn on heartbeat for this
session and do an initial account check */
	/* on_hangup */ process_hangup, 	/* On hangup - most important place
to go bill */
	/* on_exch_media */ NULL,
	/* on_soft_exec */ NULL,
	/* on_consume_med */ NULL,
	/* on_hibernate */ NULL,
	/* on_reset */ NULL,
	/* on_park */ NULL,
	/* on_reporting */ NULL,
	/* on_destroy */ NULL
};


static switch_status_t
check_billing_before_routing(switch_core_session_t *session)
{
	//is it possible to identify the legs (A or B) here?
	...
}
	
	static switch_status_t process_hangup(switch_core_session_t *session)
{
	...
}

BR,
Charles



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list