[asterisk-dev] BOUNTY: Implement application MWIMessageSend to call libpri routine

John R. Covert covert at covert.org
Wed Feb 9 18:16:13 CST 2011


Just to let everyone who has been sitting on the edge of their
seats watching from the 50-yard-line know the outcome, today I
tested a routine written by a gentleman in Germany, which worked
first try to turn lights on and off on Avaya Definity phones.

I pass simply the span number (e.g. 1), the 5-digit Definity
extension (last 5D of the Asterisk 7D mailbox number), and a
1=on or 0=off to the routine.  The crux of the routine is:

call = pri_new_call(pris[span_no - 1].pri.pri); /* obtain cref */

if (activate > 0) {
	res = pri_mwi_activate(pris[span_no - 1].pri.pri, call,
		orig_number, (PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164,
		orig_name, PRES_ALLOWED_NETWORK_NUMBER, dest_number,
		(PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164);
} else {
	res = pri_mwi_deactivate(pris[span_no - 1].pri.pri, call,
		orig_number, (PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164,
		orig_name, PRES_ALLOWED_NETWORK_NUMBER, dest_number,
		(PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164);
}

Although he wasn't able to make it a pure app_x.c with no mods to
any other module (he had trouble making an app_x.c module link
properly to a direct call into libpri and we needed the pris[]
array which is local to chan_dahdi.c so we have some additional
code, but no modified code, in chan_dahdi.c), I'm paying him the
full bounty, and he will see Eu364.30 appear in his account as
soon as he tells me where to send it.

Question: did he need to do something to destroy the call created
with pri_new_call, i.e., do I have a memory leak?  I oughta dock
him about Eu14.30 if that's the case. :-)

I'll be making some changes to incorporate it; Initially I'll
call it from the dialplan; later I'll do some other integration.
I'll want to call it from the external event code, and I'll also
want to send a complete refresh of all mailboxes once a day in
case the Definity is rebooted and loses its local memory.  As I
understand it, the messages asterisk is sending don't go directly
to the phone; they update a mwi structure for each extension in
the Definity, so that when you unplug and replug a phone, it's
light is restored without any action required from the remote
source.

Thanks to all who have commented along the way.

/john



More information about the asterisk-dev mailing list