Monday, April 21, 2008

Happy Fun Asterisk: Emulate Nortel Meridian LD95/CPND in Asterisk with SCCP

If you are asking yourself "WTF?" in reference to the title of this post, well...so am I. LOL!

I run an Asterisk phone system at home. It is great for totally destroying telemarketers! If you don't know what Asterisk is, familiarize yourself here: http://www.asterisk.org.

I run two Nortel Meridian Option 11c phone switches at work, each in a separate building about 1km apart. They are connected together via our LAN and a T-1 tie line, and both run Succession 3.0.

For those familiar with Nortel Meridian switches, there is a program load of "95" that handles what is called the CPND database. CPND stands for "Calling Party Name Display", and is a database of directory numbers (local to the switch) that have names attached to them. So you can assign extension 100 to Suzy Lu and 101 to Billy Rex, etc.

If you have Asterisk, you can do similar with its built-in database services if you are running Cisco phones with the SCCP firmware and are using chan_sccp on your Asterisk box. On my home network, I have three Cisco 7912s and two Cisco 7940s running SCCP 8.0.

In the Asterisk database, I created a table called CPND and loaded it with my extensions and their associated names, thus:

database put CPND 210 Office
database put CPND 220 Living Room
...etc...


Using the application SetCalledParty() in the chan_sccp driver, you can then add a piece to your internal dialing macro...you DO have an internal dialing macro, don't you?...to force the display of the called party on the phone you are calling FROM. The phone you are calling TO gets the CPND information from the channel driver anyhow.

Here is my internal dialing macro with the database lookup information...

[macro-dialinternal]
exten => s,1,NoOp(*** Internal Call to Ext ${MACRO_EXTEN} < ${CALLERID(all)})
exten => s,n,GotoIf($[ ${DB_EXISTS(cpnd/${MACRO_EXTEN})} ]?cpnd:nocpnd)
exten => s,n(cpnd),SetCalledParty("${DB(cpnd/${MACRO_EXTEN})}" <${MACRO_EXTEN}>)
exten => s,n,Goto(dial)
exten => s,n(nocpnd),SetCalledParty("Internal" <${MACRO_EXTEN}>)
exten => s,n,Goto(dial)
exten => s,n(dial),Dial(${ARG1}/${MACRO_EXTEN},30,Ttr)
exten => s,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => s,n(unavail),Voicemail(100,g(3))
exten => s,n,Hangup()
exten => s,n(busy),Voicemail(100,g(3))
exten => s,n,Hangup()

You don't explicitly need to use this feature. In fact, I didn't know about the application until I watched Asterisk load while debugging a dialplan issue. You can use the app to change the display to say whatever you want...

SetCalledParty("Mom's House" <2345678901>)
SetCalledParty("Joe's Crib" <8005551212>)
SetCalledParty("Jerks" <3178169336>)

This is a pretty useful app, but is only part of the chan_sccp driver and will probably only work on phones that use SCCP compatible firmware. I have not tried it on a SIP device, but I don't think it will do anything.

I hope to have more Happy Fun Blog Entries soon...

2 comments:

Shari said...

This was all so completely over my head! However, I'm glad to see you updated! :-)

badmoodguy (Бадмўдгуи) said...

Don't feel bad...some of this stuff is alien to me, too. I've been phone guy at work for a long time, but for anything major I've had a support vendor to rely on. For the past two years we've had a shit vendor that didn't know anything about Nortel switches (why we hired them was beyond me) and I had to rely on their cryptic manuals and support from newsgroups and forums to keep these things running. I have learned a lot about Nortel switches and figured I might as well share what little I've learned.

I will, of course, update with some real world things, too, as soon as I get a chance...