Saturday, April 27, 2013

Asterisk and Cisco 7940 basic config file examples


Here are some very basic examples of configurations used to get a Cisco 7940 running on Asterisk.  The phone I'm using is running P0S3-8-12-00 and it's Asterisk 11.3.

Basic files used by the phone:

SIPDefault.cnf 
# file is downloaded by phone at boot up
# name is case sensitive

#image_version shows the firmware image to get from the TFTP server.
image_version: P0S3-08-12-00

# NAT/Firewall Traversal
# this seens to be required by the 7940s
# debugging SIP on the Asterisk server indicates authentication failures without it
# which in my case had nothing to do with users and passwords
nat_enable: "0"

# define your proxy / SIP server
proxy1_address: "192.168.10.2"
# tell the phone to register to the proxy
proxy_register: "1"

# define dialplan.xml as the file defining the phones dial plan
# this is not required but
# to at least avoid users needing to press the "dial" key after dialing
# or waiting for an inter-digit timeout, create a file that defines well known patterns
dial_template: "dialplan"

# define number to be dialed by messages button
# not required but given the phone has a big "messages" button
# it seems like it should work
messages_uri: "6500"


SIP0006D725E4D4.cnf
# file is downloaded by phone at boot up
# name is case sensitive
# format is SIP.cnf

# Text next to button on phone
# Like a CUCM Line Label
line1_name: Office1

# name used in Asterisk sip.conf to define SIP peer
line1_authname: "Office1"
line1_displayname: "Office1"

# secret used in Asterisk sip.conf

# using MAC address here to keep it complicated but easily remembered
line1_password: "0006D725E4D4"

# Phone Label displayed in upper right corner with no effect on SIP
# this is just cosmetic
phone_label: "7164330263"


dialplan.xml
# file is downloaded by phone at boot up
# name is case sensitive
# this is optional and will only be downloaded if exists in
# the SIPDefault.cnf file


<DIALTEMPLATE>
    <TEMPLATE MATCH="011*" Timeout="6" User="Phone"/><!-- International calls -->
    <TEMPLATE MATCH="1.........." Timeout="0" User="Phone"/> <!-- Long Distance are 1+10 digits -->
    <TEMPLATE MATCH="......." Timeout="0" User="Phone"/><!-- Local numbers are 7 digits here -->
    <TEMPLATE MATCH="*" Timeout="5"/><!-- Anything else, don't really care right now -->
</DIALTEMPLATE>


Basic file elements used by Asterisk:

sip.conf
; see extensions.conf file for how the 
: contexts below are used
[CiscoRouterIn]
context=pstn-incoming
type=friend
host=192.168.10.1
dtmfmode=rfc2833
disallow=all
allow=ulaw
; below is very important
; others said insecure = very is appropriate
; research
; http://www.voip-info.org/wiki/view/Asterisk+config+sip.conf
insecure=port

[CiscoRouterOut]
context=pstn-outgoing
type=friend
host=192.168.10.1
dtmfmode=rfc2833
allow=ulaw
insecure=port

[Office1]
; line 1 on 7940 phone
type=friend
host=dynamic
nat=no
secret=0006D725E4D4
context=users
deny=0.0.0.0/0
permit=10.1.1.0/255.255.255.0
callerid="7164330263" <6002>
mailbox=6002@maslankavm


extensions.conf
[users]
; include access to outgoing routes from users
include=>pstn-outgoing

; how to call my phone and forward to vmail
exten=>6002,1,Dial(SIP/Office1,20)
exten=>6002,n,VoiceMail(6002@maslankavm,u)

[pstn-incoming]
;this provides access to users extensions from pstn-incoming (SIP ciscorouter1)
include=>users

[pstn-outgoing]
; dial 7 for out and strip 1
;exten=>_7.,1,Dial(SIP/${EXTEN:1}@CiscoRouterOut,60,r)
exten=>_NXXXXXX,1,Dial(SIP/${EXTEN}@CiscoRouterOut,60,r)
exten=>_1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@CiscoRouterOut,60,r)


voicemail.conf
; I use GMail and will use them as my SMTP server
; T believe this requires something besides sendmail
; due to the way GMail uses TLS / SSL
; mailcmd=/usr/sbin/sendmail -t
; nice write up here: http://jonathanmanning.com/2011/07/15/how-to-configure-asterisk-to-send-voicemail-email-via-gmail-smtp-guide/
mailcmd=/usr/sbin/ssmtp -t

[maslankavm]
; here's my voicemail context and a basic mailbox that will forward to GMail
6002 => 12345,Somebody's Name,Some.Body@gmail.com,,attach=yes|tz=eastern



Thursday, April 25, 2013

Find Cisco phone devices associated with CUCM NumberOfRegisteredPhonesDropped alert


See: http://webmaxtor.blogspot.com/2011/01/find-gateway-associated-with-cucm.html for similar information related to MGCP gateways dropping.

After configuring RTMT NumberOfRegisteredPhonesDropped alert to deliver information via email, I found associated phone device details are not included in the email. This can be a real problem on larger scale deployments and no other reporting tools available.

To find the devices in question:
  1. Freak out when receiving [RTMT-ALERT-StandAloneCluster] NumberOfRegisteredPhonesDropped alert.
  2. Hope the traces have been enabled in CUCM. The default Error level on CallManager should be sufficient.
  3. Go to RTMT | SysLog Viewer, and select a Node at the top of the right pane (the logs are specific to servers, so this might be tedious).
  4. In the Logs tab, go to Application Logs | AlternateSyslog .
    1. Your results may vary depending on versions.  Your option may be Application Logs | Archive | CiscoSysLog or something similar.
  5. In the bottom grid, scroll to the approximate time of the alert.
    1. If you choose the Save button at the bottom of the screen, you can save the AlternateSyslog to a text file to be searched with a text editor (Use something besides MS Notepad to save yourself headaches. I like Notepad++ at http://notepad-plus-plus.org/).
  6. Search for EndPointUnregistered, StationConnectionError or maybe DeviceTransientConnection in the Message column.
  7. The DeviceName, IP address, Description, etc. of the affected device(s) will be included in the message.
  8. Note the Reason value in the message. It will shed light on why the device is unregistered.
  9. Search http://www.cisco.com for System Error Messages for Cisco Unified Communications Manager  and find one appropriate to your CUCM version.
  10. Search that document for EndPointUnregistered for a description of why a phone was unregistered.
  11. Fix something.
Of course, your results may vary.

If you're in the right place, here's what it looks like on a CUCM 8.6 using RTMT 8.91:

Sunday, April 14, 2013

Asterisk voice mail and not requiring entering a mailbox number for retrieval


My Cisco Unity Express module exploded recently, so being without a (world's most expensive) home answering machine, I thought I'd just commit to running Asterisk and it's voice mail system instead.

I haven't fiddled with starting up Asterisk from scratch in years, but given I might actually use it now, it seemed to be worth the effort familiarizing myself with all the CLI / configuration options again.

I managed to get a new version of X-Lite 4 from http://www.counterpath.com/x-lite.html running and registered, was able to forward it to voice mail  and could retrieve voice mail by dialing an extension for the VoiceMailMain application.  I struggled with removing the requirement to enter an extension number though.

What I found is that I needed to pass the caller id of my X-Lite 4 device via the SIP.CONF configuration, to be handled by the ${CALLERID(num) variable in the EXTENSIONS.CONF entry.

Here's the relevant snippets:

SIP.CONF

[general]
context=default
allowguest=no

[web1]
type=friend
host=dynamic
secret=web2
context=users
deny=0.0.0.0/0
permit=192.168.10.0/255.255.255.0
; below define caller id that will be processed by the VoiceMailMain / CALLERID(num) variable
callerid="web1" <6001>


EXTENSIONS.CONF

[default]

[demo]

[users]
; test xlite phone
exten=>6001,1,Dial(SIP/web1,20)
exten=>6001,n,VoiceMail(6001@webvm,u)

; generic voicemail retrieval app
exten=>6500,1,Answer(500)
; below catch caller id that represents voice mail box number
exten=>6500,n,VoiceMailMain(${CALLERID(num)}@webvm)


VOICEMAIL.CONF

[webvm]

; simple voice mail box setup
6001 => 12345,Web,web@web.com,web@web.com,attach=no|tz=eastern

Tuesday, April 09, 2013

Cisco CUCM and Caller ID / CLID sending


I don't know where I scraped up this information originally, but it now seems to live at: https://supportforums.cisco.com/docs/DOC-1861

How to send / places to configure CLID (caller id) from Cisco CUCM
 ------------------------------------------------------
1.  "Directory Number Configuration" page.

Scroll down to "External Phone Number Mask". Enter here the number that you want to send to the PSTN. Then click on "update" at the top of the page. You have to repeat this same procedure for the other extensions configured for this IP Phone (if you want to send those numbers also to the PSTN).
------------------------------------------------------
2.  "Route Pattern Configuration" page.

Locate the route pattern that you are using for doing calls to the PSTN.

Scroll down to the "Calling Party Transformations" section.

- If you check the "Use Calling Party's External Phone Number Mask" checkbox, you will use the number that you configured in the "Directory Number Configuration" page as caller ID.

- If you uncheck that checkbox, then you can configure the "Calling Party Transform Mask". Just enter here a number like, as an example, 978858xxxx (CUCM will fill out the xxxx with phone's 4-digit extension).
------------------------------------------------------
3.  "Route List Detail Configuration" page.

Go to the "Calling Party Transformations" section.

If you set "Use Calling Party's External Phone Number Mask"  to "on", you will use the number that you configured in the "Directory Number Configuration" page as caller ID. If you set it to "off", then you need to configure the "Calling Party Transform Mask" (next line on this same page). The setting that you use here will override the settings that you configured in the "Route Pattern Configuration" page.

You configure the "Calling Party Transform Mask" here in the same way as explained for the "Route Pattern Configuration" page.
------------------------------------------------------
4.  "Gateway Configuration" page.

Go to the Gateway and select the PRI that you are using for outgoing calls. Under 'Outbound Calls' you should see the Caller ID DN field. In here you can configure also the Caller ID.
------------------------------------------------------
In other words Caller ID works as follows:

  1. Gateway configuration overrides everything else.
  2. Route List configuration overrides the Route Pattern and the Directory Number Configuration.
  3. Route Pattern overrides only the Directory Number configuration.