EEM Applet to augment IOS sip-ua response to SIP registration failures with multiple redundant SIP Proxies
EEM Applet to augment IOS sip-ua response to SIP registration failures with multiple redundant SIP Proxies.
The EEM applet described below is used in the IOS configuration of a Cisco IAD2431 Voice Gateway that used to connect a PBX to a SIP-based telephone network. The current SIP User Agent (sip-ua) built into the 2431's IOS performs well in normal operation and in some error cases where it is unsuccessful in attempting to register with the first of it's 3 available SIP proxies. For example, when the IOS sip-ua receives no response at all to it's SIP REGISTER requests, it successfully rotates among the 3 SIP proxies return by its DNS query until it receives a successful 200 OK response from any one of the three proxies. However, if the IOS sip-ua receives repeated SIP error responses to its REGISTER messages, such as a SIP 403 Forbidden, a 408 Timeout, a 480 Termporarily Unavailable or a 500 Internal Server Error, the IOS sip-ua does not try to register with a different redundant SIP proxy. Instead, it waits for a configurable time, such as 3 minutes, during which it cannot provide telephone service to the PBX. After 3 minutes, it attempts to register again with the same SIP Proxy IP address. The 2431 can repeat this behavior indefinitely, even though one or both of the other 2 Proxies it received via DNS query may be able to successfully handle its SIP registration request and enter normal telephone call processing mode for the PBX. Also, the 2431 does not re-register with its SIP Proxies if the IP address it received via DHCP expires and it receives a new, different IP address via DHCP. Under normal circumstances, the 2431 will be able to renew its DHCP lease for the same IP address it previously had leased. However, periodically network administrators must perform a 'Re-IP' procedure to maintain the network's IP address ranges, resulting in a new DHCP IP address assignment to the 2431, which could cause a lengthy telephone service interruption to the 2431's PBX if the 2431 does not promptly register its new IP address with its SIP proxy.
The EEM applet described below enhances the 2431's behavior in these unusual situations to automatically recover its SIP registration with a working SIP proxy to quickly restore telephone service to the PBX. The applet has been extensively tested and is deployed in the network. The applet is triggered by detection of increments of the 2431's internal SNMP counter OIDs in the IOS SIP MIB that are configured as EEM events. The counter OIDs used are incremented when the IOS sip-ua receives 403, 408, 480 or 500 errors respectively, which could be from in response to REGISTER requests or to any other SIP request such as an INVITE, BYE, CANCEL, etc. The applet also detects sip-ua counter OID incremented by SIP INVITE retries, as well as a routing OID that is incremented when a DHCP discover results in the addition a new IP route. When the EEM applet is triggered, it first checks to see if it was assigned a new IP address by DHCP, and if so immediately executes a CLI command sequence described below that performs a new SIP registration. If DHCP did not trigger the applet, it next checks its SIP registration status, by issuing the IOS CLI command 'show sip-ua register status' command and looking for the string 'yes' in the response. If its SIP registration is expired, the applet immediately executes the series of IOS commands that first flushes the DNS hosts cache, then enters global configuration mode, enters the sip-ua config mode, issues the 'no registrar' command, waits 2 seconds, and then re-issues the normal 'registrar' command containing the dns:<sip-proxy fqdn> argument. As a result of this CLI sequence, the 2431's sip-ua first de-registers with the last SIP Proxy IP address it had resolved, then performs a DNS query for the SIP Proxy FQDN, and finally issues a SIP REGISTER request to the 1st IP address returned by the DNS query. The 2431's DNS server is configured to rotate the order of its configured SIP Proxy IP addresses in its replies to each successive DNS query it recieves from any of the multiple IAD2431's deployed in the network configured with the same SIP Proxy FQDN. Thus the 2431's query has a probability of 2/3 of receiving a different SIP Proxy IP address as first choice in the DNS reply. The 2431 IOS sip-ua then performs a new SIP REGISTER to the new 1st choice Proxy. Then the EEM applet then waits 10 seconds and again issues the 'show sip-ua register status' CLI command and looks for 'yes' in the response; if 'yes' is not found the applet repeats the CLI command sequence up to 6 times before going into a randomized backoff timer loop for 200 - 400 seconds. If upon initial trigger of the applet, its SIP Registration was not expired, the applet just increments a 'leakey bucket' error count by 4. Then the applet reads other SNMP OIDs that record successful calls and decrements the bucket count by 2 for each successful call since the last time the applet was executed. Finally, the applet checks to see whether the bucket count has reached a threshold of 40, and if so, the applet executes the CLI sequence described above to clear the hosts cache and perform a new SIP REGISTER. Below is the RegBucket applet listing, followed by the companion InitVars applet listing, both of which are entered into the IOS configuration. Below the applet is the normal 'sip-ua' and 'voice service voip' sections of the IOS configuration for reference.
event manager applet RegBucket
description RegBucket performs Re-Registration with multiple SIP Proxys upon various SIP errors using a leaky bucket algorithm.
event tag 403 snmp oid 184.108.40.206.220.127.116.11.18.104.22.168.7.0 get-type exact entry-op ge entry-val "1" entry-type increment poll-interval 30 maxrun 7200
event tag 408 snmp oid 22.214.171.124.126.96.36.199.188.8.131.52.17.0 get-type exact entry-op ge entry-val "1" entry-type increment poll-interval 30
event tag 480 snmp oid 184.108.40.206.220.127.116.11.18.104.22.168.33.0 get-type exact entry-op ge entry-val "1" entry-type increment poll-interval 30
event tag 500 snmp oid 22.214.171.124.126.96.36.199.188.8.131.52.1.0 get-type exact entry-op ge entry-val "1" entry-type increment poll-interval 30
event tag InviteRetries snmp oid 184.108.40.206.220.127.116.11.18.104.22.168.1.0 get-type exact entry-op ge entry-val "2" entry-type increment poll-interval 30
event tag dhcp routing network 0.0.0.0/0 type add protocol connected ge 1
correlate event 403 or event 408 or event 480 or event 500 or event InviteRetries or event dhcp
Cisco – how to schedule an unattended reload with EEM · June 22, 2011 / Yuri /
This link shows the 'action nnn reload' command. Of course you need to use the appropriate 'if' or other condition testing command to determine when/whether to reboot. From my applet above, you could use:
action 700 cli command "show sip-ua register status | include yes"
action 710 string first "yes" "$_cli_result"
action 730 if $_string_result gt 0 goto nnn
Of course the details of these and other commands are documented in the EmbeddedEventManagerCommandReference-eem-cr-book.pdf and the Writing-EEM-Policies-Using-CLI-15.0-nm_eem_policy_cli.pdf documents, both available on the Cisco web site.
We are pleased to announce availability of Beta software for 16.6.3.
16.6.3 will be the second rebuild on the 16.6 release train targeted
towards Catalyst 9500/9400/9300/3850/3650 switching platforms. We are
looking for early feedback from customers befor...
Introduction Featured Speakers Luis Espejel is the Telecommunications
Manager of IENova, an Oil & Gas company. Currently he works with Cisco
IOS® and Cisco IOS XE platforms, and NX to some extent. He has also
worked as a Senior Engineer with the Routing P...
In this session you can learn more about Layer 3 multicast and the best
practices to identify possible threats and take security measures. It
provides an overview of basic multicast, the best security practices for
use of this technology, and recommendati...