Thursday, March 31, 2016

Register Cisco 8851,9971 to Freepbx(Asterisk)







1.Freepbx needs to have transport mode TCP enabled. to do this, edit file /etc/asterisk/sip_general_custom.conf with the following lines,

tcpenable=yes  
tcpbindaddr=0.0.0.0

Then, under device(or extension) setting in Freepbx, for the phone number you want the phone to associate with, set


2. Optionally, grab a working phone configuration file SEPxxxxxxxxxxxx.cnf.xml from a Cisco Callmanager.This configuration serves as a template.

3. Config file for 8851.
<device> 
   <deviceProtocol>SIP</deviceProtocol> 
   <sshUserId>admin</sshUserId> 
   <sshPassword>password</sshPassword> 
   <devicePool> 
      <dateTimeSetting> 
         <dateTemplate>M/D/YA</dateTemplate> 
         <timeZone>Eastern Standard/Daylight Time</timeZone> 
         <ntps> 
            <ntp> 
               <name>pool.ntp.org</name> 
               <ntpMode>Unicast</ntpMode> 
            </ntp>         
         </ntps> 
      </dateTimeSetting> 
      <callManagerGroup> 
         <members> 
            <member priority="0"> 
               <callManager> 
                  <ports> 
                     <ethernetPhonePort>2000</ethernetPhonePort> 
                     <sipPort>5060</sipPort> 
                     <securedSipPort>5061</securedSipPort> 
                  </ports> 
                  <processNodeName>[Your Freepbx IP]</processNodeName> 
               </callManager> 
            </member> 
         </members> 
      </callManagerGroup> 
   </devicePool> 
   <sipProfile> 
      <sipProxies> 
         <backupProxy></backupProxy> 
         <backupProxyPort>5060</backupProxyPort> 
         <emergencyProxy></emergencyProxy> 
         <emergencyProxyPort></emergencyProxyPort> 
         <outboundProxy></outboundProxy> 
         <outboundProxyPort></outboundProxyPort> 
         <registerWithProxy>true</registerWithProxy> 
      </sipProxies> 
      <sipCallFeatures> 
         <cnfJoinEnabled>true</cnfJoinEnabled> 
         <callForwardURI>x-serviceuri-cfwdall</callForwardURI> 
         <callPickupURI>x-cisco-serviceuri-pickup</callPickupURI> 
         <callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI> 
         <callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI> 
         <meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI> 
         <abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI> 
         <rfc2543Hold>false</rfc2543Hold> 
         <callHoldRingback>2</callHoldRingback> 
         <localCfwdEnable>true</localCfwdEnable> 
         <semiAttendedTransfer>true</semiAttendedTransfer> 
         <anonymousCallBlock>2</anonymousCallBlock> 
         <callerIdBlocking>2</callerIdBlocking> 
         <dndControl>0</dndControl> 
         <remoteCcEnable>true</remoteCcEnable> 
      </sipCallFeatures> 
      <sipStack> 
         <sipInviteRetx>6</sipInviteRetx> 
         <sipRetx>10</sipRetx> 
         <timerInviteExpires>180</timerInviteExpires> 
         <timerRegisterExpires>3600</timerRegisterExpires> 
         <timerRegisterDelta>5</timerRegisterDelta> 
         <timerKeepAliveExpires>120</timerKeepAliveExpires> 
         <timerSubscribeExpires>120</timerSubscribeExpires> 
         <timerSubscribeDelta>5</timerSubscribeDelta> 
         <timerT1>500</timerT1> 
         <timerT2>4000</timerT2> 
         <maxRedirects>70</maxRedirects> 
         <remotePartyID>false</remotePartyID> 
         <userInfo>None</userInfo> 
      </sipStack> 
      <autoAnswerTimer>1</autoAnswerTimer> 
      <autoAnswerAltBehavior>false</autoAnswerAltBehavior> 
      <autoAnswerOverride>true</autoAnswerOverride> 
      <transferOnhookEnabled>false</transferOnhookEnabled> 
      <enableVad>false</enableVad> 
      <dtmfAvtPayload>101</dtmfAvtPayload> 
      <dtmfDbLevel>3</dtmfDbLevel> 
      <dtmfOutofBand>avt</dtmfOutofBand> 
      <alwaysUsePrimeLine>false</alwaysUsePrimeLine> 
      <alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail> 
      <kpml>3</kpml> 
      <phoneLabel>FlyYoung</phoneLabel> 
      <stutterMsgWaiting>1</stutterMsgWaiting> 
      <callStats>false</callStats> 
      <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts> 
      <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig> 
      <sipLines> 
         <line button="1"> 
            <featureID>9</featureID> 
            <featureLabel>[Directory Number]</featureLabel> 
            <proxy>[Your Freepbx IP]</proxy> 
            <port>5060</port> 
            <name>[Directory Number]</name> 
            <displayName>[Directory Number]</displayName> 
            <autoAnswer> 
               <autoAnswerEnabled>2</autoAnswerEnabled> 
            </autoAnswer> 
            <callWaiting>3</callWaiting> 
            <authName>[Directory Number]</authName> 
            <authPassword>[device registration password]</authPassword> 
            <sharedLine>false</sharedLine> 
            <messageWaitingLampPolicy>3</messageWaitingLampPolicy> 
            <messagesNumber>*97</messagesNumber> 
            <ringSettingIdle>4</ringSettingIdle> 
            <ringSettingActive>5</ringSettingActive> 
            <contact>100</contact> 
            <forwardCallInfoDisplay> 
               <callerName>true</callerName> 
               <callerNumber>false</callerNumber> 
               <redirectedNumber>false</redirectedNumber> 
               <dialedNumber>true</dialedNumber> 
            </forwardCallInfoDisplay> 
         </line>
      </sipLines> 
      <voipControlPort>5060</voipControlPort> 
      <startMediaPort>16348</startMediaPort> 
      <stopMediaPort>20134</stopMediaPort> 
      <dscpForAudio>184</dscpForAudio> 
      <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy> 
      <dialTemplate>dialplan.xml</dialTemplate> 
      <softKeyFile></softKeyFile> 
   </sipProfile> 
   <commonProfile> 
      <phonePassword></phonePassword> 
      <backgroundImageAccess>true</backgroundImageAccess> 
      <callLogBlfEnabled>2</callLogBlfEnabled> 
   </commonProfile> 
   <loadInformation>SIP88xx.10-2-2-16</loadInformation> 
   <vendorConfig> 
      <disableSpeaker>false</disableSpeaker> 
      <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset> 
      <pcPort>0</pcPort> 
      <settingsAccess>1</settingsAccess> 
      <garp>0</garp> 
      <voiceVlanAccess>0</voiceVlanAccess> 
      <videoCapability>0</videoCapability> 
      <autoSelectLineEnable>0</autoSelectLineEnable> 
      <webAccess>0</webAccess> 
   <sshAccess>0</sshAccess>
   <sshPort>22</sshPort>
      <daysDisplayNotActive>1,7</daysDisplayNotActive> 
      <displayOnTime>08:00</displayOnTime> 
      <displayOnDuration>00:05</displayOnDuration> 
      <displayIdleTimeout>00:05</displayIdleTimeout> 
      <spanToPCPort>1</spanToPCPort> 
      <loggingDisplay>1</loggingDisplay> 
      <loadServer></loadServer> 
   </vendorConfig> 
   <userLocale> 
      <name>English_United_States</name> 
      <uid>1</uid> 
      <langCode>en_US</langCode> 
      <version>1.0.0.0-1</version> 
      <winCharSet>iso-8859-1</winCharSet> 
   </userLocale> 
   <networkLocale>United_States</networkLocale> 
   <networkLocaleInfo> 
      <name>United_States</name> 
      <uid>64</uid> 
      <version>1.0.0.0-1</version> 
   </networkLocaleInfo>    
   <deviceSecurityMode>1</deviceSecurityMode> 
   <authenticationURL></authenticationURL> 
   <directoryURL>http://[Your Freepbx IP]/ciscodir/menu.xml</directoryURL> 
   <servicesURL></servicesURL> 
   <idleURL></idleURL> 
   <informationURL></informationURL> 
   <messagesURL></messagesURL> 
   <proxyServerURL></proxyServerURL> 
   <dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig> 
   <dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices> 
   <dscpForCm2Dvce>96</dscpForCm2Dvce> 
   <transportLayerProtocol>2</transportLayerProtocol><!--Note, transport has to be 2(tcp) to work, 4(UDP) doesn't work for 88xx/99xx--> 
   <capfAuthMode>0</capfAuthMode> 
   <capfList> 
      <capf> 
         <phonePort>3804</phonePort> 
      </capf> 
   </capfList> 
   <certHash></certHash> 
   <encrConfig>false</encrConfig>
</device>

4.Config file for 9971
<device> 
   <deviceProtocol>SIP</deviceProtocol> 
   <sshUserId>admin</sshUserId> 
   <sshPassword>password</sshPassword> 
   <devicePool> 
      <dateTimeSetting> 
         <dateTemplate>M/D/YA</dateTemplate> 
         <timeZone>Eastern Standard/Daylight Time</timeZone> 
         <ntps> 
            <ntp> 
               <name>pool.ntp.org</name> 
               <ntpMode>Unicast</ntpMode> 
            </ntp>         
         </ntps> 
      </dateTimeSetting> 
      <callManagerGroup> 
         <members> 
            <member priority="0"> 
               <callManager> 
                  <ports> 
                     <ethernetPhonePort>2000</ethernetPhonePort> 
                     <sipPort>5060</sipPort> 
                     <securedSipPort>5061</securedSipPort> 
                  </ports> 
                  <processNodeName>[Your Freepbx IP]</processNodeName> 
               </callManager> 
            </member> 
         </members> 
      </callManagerGroup> 
   </devicePool> 
   <sipProfile> 
      <sipProxies> 
         <backupProxy></backupProxy> 
         <backupProxyPort>5060</backupProxyPort> 
         <emergencyProxy></emergencyProxy> 
         <emergencyProxyPort></emergencyProxyPort> 
         <outboundProxy></outboundProxy> 
         <outboundProxyPort></outboundProxyPort> 
         <registerWithProxy>true</registerWithProxy> 
      </sipProxies> 
      <sipCallFeatures> 
         <cnfJoinEnabled>true</cnfJoinEnabled> 
         <callForwardURI>x-serviceuri-cfwdall</callForwardURI> 
         <callPickupURI>x-cisco-serviceuri-pickup</callPickupURI> 
         <callPickupListURI>x-cisco-serviceuri-opickup</callPickupListURI> 
         <callPickupGroupURI>x-cisco-serviceuri-gpickup</callPickupGroupURI> 
         <meetMeServiceURI>x-cisco-serviceuri-meetme</meetMeServiceURI> 
         <abbreviatedDialURI>x-cisco-serviceuri-abbrdial</abbreviatedDialURI> 
         <rfc2543Hold>false</rfc2543Hold> 
         <callHoldRingback>2</callHoldRingback> 
         <localCfwdEnable>true</localCfwdEnable> 
         <semiAttendedTransfer>true</semiAttendedTransfer> 
         <anonymousCallBlock>2</anonymousCallBlock> 
         <callerIdBlocking>2</callerIdBlocking> 
         <dndControl>0</dndControl> 
         <remoteCcEnable>true</remoteCcEnable> 
      </sipCallFeatures> 
      <sipStack> 
         <sipInviteRetx>6</sipInviteRetx> 
         <sipRetx>10</sipRetx> 
         <timerInviteExpires>180</timerInviteExpires> 
         <timerRegisterExpires>3600</timerRegisterExpires> 
         <timerRegisterDelta>5</timerRegisterDelta> 
         <timerKeepAliveExpires>120</timerKeepAliveExpires> 
         <timerSubscribeExpires>120</timerSubscribeExpires> 
         <timerSubscribeDelta>5</timerSubscribeDelta> 
         <timerT1>500</timerT1> 
         <timerT2>4000</timerT2> 
         <maxRedirects>70</maxRedirects> 
         <remotePartyID>false</remotePartyID> 
         <userInfo>None</userInfo> 
      </sipStack> 
      <autoAnswerTimer>1</autoAnswerTimer> 
      <autoAnswerAltBehavior>false</autoAnswerAltBehavior> 
      <autoAnswerOverride>true</autoAnswerOverride> 
      <transferOnhookEnabled>false</transferOnhookEnabled> 
      <enableVad>false</enableVad> 
      <dtmfAvtPayload>101</dtmfAvtPayload> 
      <dtmfDbLevel>3</dtmfDbLevel> 
      <dtmfOutofBand>avt</dtmfOutofBand> 
      <alwaysUsePrimeLine>false</alwaysUsePrimeLine> 
      <alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail> 
      <kpml>3</kpml> 
      <phoneLabel>FlyYoung</phoneLabel> 
      <stutterMsgWaiting>1</stutterMsgWaiting> 
      <callStats>false</callStats> 
      <silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts> 
      <disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig> 
      <sipLines> 
         <line button="1"> 
            <featureID>9</featureID> 
            <featureLabel>101</featureLabel> 
            <proxy>[Your Freepbx IP]</proxy> 
            <port>5060</port> 
            <name>[Directory Number]</name> 
            <displayName>[Directory Number]</displayName> 
            <autoAnswer> 
               <autoAnswerEnabled>2</autoAnswerEnabled> 
            </autoAnswer> 
            <callWaiting>3</callWaiting> 
            <authName>[Directory Number]</authName> 
            <authPassword>password</authPassword> 
            <sharedLine>false</sharedLine> 
            <messageWaitingLampPolicy>3</messageWaitingLampPolicy> 
            <messagesNumber>*97</messagesNumber> 
            <ringSettingIdle>4</ringSettingIdle> 
            <ringSettingActive>5</ringSettingActive> 
            <contact>101</contact> 
            <forwardCallInfoDisplay> 
               <callerName>true</callerName> 
               <callerNumber>false</callerNumber> 
               <redirectedNumber>false</redirectedNumber> 
               <dialedNumber>true</dialedNumber> 
            </forwardCallInfoDisplay> 
         </line>
      </sipLines> 
      <voipControlPort>5060</voipControlPort> 
      <startMediaPort>16348</startMediaPort> 
      <stopMediaPort>20134</stopMediaPort> 
      <dscpForAudio>184</dscpForAudio> 
      <ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy> 
      <dialTemplate>dialplan.xml</dialTemplate> 
      <softKeyFile></softKeyFile> 
   </sipProfile> 
   <commonProfile> 
      <phonePassword></phonePassword> 
      <backgroundImageAccess>true</backgroundImageAccess> 
      <callLogBlfEnabled>2</callLogBlfEnabled> 
   </commonProfile> 
   <loadInformation>sip9971.9-4-1-9</loadInformation> 
   <vendorConfig> 
      <disableSpeaker>false</disableSpeaker> 
      <disableSpeakerAndHeadset>false</disableSpeakerAndHeadset> 
      <pcPort>0</pcPort> 
      <settingsAccess>1</settingsAccess> 
      <garp>0</garp> 
      <voiceVlanAccess>0</voiceVlanAccess> 
      <videoCapability>1</videoCapability><!--0 disable 1 enable--> 
      <ciscoCamera>1</ciscoCamera><!--0 disable 1 enable--> 
   <autoSelectLineEnable>0</autoSelectLineEnable> 
      <webAccess>0</webAccess> 
   <sshAccess>0</sshAccess>
   <sshPort>22</sshPort>
      <daysDisplayNotActive>1,7</daysDisplayNotActive> 
      <displayOnTime>08:00</displayOnTime> 
      <displayOnDuration>00:05</displayOnDuration> 
      <displayIdleTimeout>00:05</displayIdleTimeout> 
      <spanToPCPort>1</spanToPCPort> 
      <loggingDisplay>1</loggingDisplay> 
      <loadServer></loadServer> 
   </vendorConfig> 
   <userLocale> 
      <name></name> 
      <uid>1</uid> 
      <langCode>en_US</langCode> 
      <version>1.0.0.0-1</version> 
      <winCharSet>iso-8859-1</winCharSet> 
   </userLocale> 
   <networkLocale></networkLocale> 
   <networkLocaleInfo> 
      <name></name> 
      <uid>64</uid> 
      <version>1.0.0.0-1</version> 
   </networkLocaleInfo>    
   <deviceSecurityMode>1</deviceSecurityMode> 
   <authenticationURL></authenticationURL> 
   <directoryURL>http://[Your Freepbx IP]/ciscodir/menu.xml</directoryURL> 
   <servicesURL></servicesURL> 
   <idleURL></idleURL> 
   <informationURL></informationURL> 
   <messagesURL></messagesURL> 
   <proxyServerURL></proxyServerURL> 
   <dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig> 
   <dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices> 
   <dscpForCm2Dvce>96</dscpForCm2Dvce> 
   <transportLayerProtocol>2</transportLayerProtocol> <!--Note, transport has to be 2(tcp) to work, 4(UDP) doesn't work for 88xx/99xx-->
   <capfAuthMode>0</capfAuthMode> 
   <capfList> 
      <capf> 
         <phonePort>3804</phonePort> 
      </capf> 
   </capfList> 
   <certHash></certHash> 
   <encrConfig>false</encrConfig> 
</device>

5.Background wallpager
For 8851, the background wallpapgers need to be stored in path /Desktops/800x480x24, check size and format specifications here.
For 8871, folder is /Desktops/640x480x24, and specifications here.

6. TFTP.
Freepbx has a TFTP server pre-intsalled.
Relevant configuration notes are as follows.

tftp conf file is located at
nano /etc/xinetd.d/tftp

# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s -c /tftpboot #default tftp root folder
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

service xinetd status to check tftp service status

netstat -a |grep tftp to monitor the live tftp traffic

Make sure to check Windows firewall for testing because it by default blocks the tftp traffic(what I experienced)


Friday, January 29, 2016

Using Excel to compare phone registration status before and after a change

This is a very simple demo that meets the most basic QA requirement.

1.Search phones under CUCM admin GUI, copy and paste the results into a spreadsheet.
2. Remove any unnecessary columns, leave only name and status column,
3. Combine the two column by typing formula =(a1&" "&b1) into the first cell of new column and copy this cell into all the following cells until the last record, so to make a "before column"
https://support.office.com/en-US/article/Combine-text-from-two-or-more-cells-into-one-cell-94700285-8458-469B-AAE9-394451A1045C
4. After the change, repeat the above steps, make an "after" column.
5. Do the comparison with conditional formating:
5.1 highlight the before column, then click conditional formatting, new rule,


5.2 select "use a formula....", enter the formula like this ,then click the Format button,


5.3 choose a color to format the text in before column when a mismatch is found in the after column.


6.Now any entry in the before column that's different from the after column will be highlighted with this color.



More excel comparison functions can be found here,
https://www.ablebits.com/office-addins-blog/2015/08/26/excel-compare-two-columns-matches-differences/#compare-two-columns-formula-free

Wednesday, January 27, 2016

Find out what CSS' have access to certain partion in CUCM with SQL query

The search clause is:

run sql select name,clause from callingsearchspace where clause LIKE '%portion of the partition name'

Wednesday, October 28, 2015

Hack italkbb SIP trunk to use with AsteriskNow

Part A. Hack into italkbb Lynksys ATA

1. Follow the first steps on this link http://blog.howardtang.com/tag/italkbb-sip/ to set up the wireshark, SPAN port, and sniff the registration packets between ATA and italkbb registrar.

The following profile is obtained:
<!--AutoEdit-->
<flat-profile>
<Display_Name_1_ ua="na">username</Display_Name_1_>
<User_ID_1_ ua="na">italkbb_account</User_ID_1_>
<Password_1_ ua="na">registration_password</Password_1_>
<Auth_ID_1_ ua="na">italkbb_account</Auth_ID_1_>
<Use_DNS_SRV_1_ ua="na">Yes</Use_DNS_SRV_1_>
<Use_DNS_SRV_2_ ua="na">Yes</Use_DNS_SRV_2_>
<Proxy_Fallback_Intvl_1_ ua="na">180</Proxy_Fallback_Intvl_1_>
<Proxy_Fallback_Intvl_2_ ua="na">180</Proxy_Fallback_Intvl_2_>
<Dial_Plan_1_ ua="na">(*xx|[3469]11|0|00|&lt;:1416&gt;[2-9]xxxxxx|899[2-9]xxxxxxS0|&lt;#:333&gt;xxxxxxxxxxxS0&gt;|1xxx[2-9]xxxxxxS0|&lt;:1&gt;[2-9]xx[2-9]xxxxxx|xxxxxxxxxxxx.)</Dial_Plan_1_>
<Dial_Plan_2_ ua="na">(*xx|[3469]11|0|00|&lt;:1416&gt;[2-9]xxxxxx|1xxx[2-9]xxxxxxS0|&lt;:1&gt;[2-9]xx[2-9]xxxxxx|xxxxxxxxxxxx.)</Dial_Plan_2_>
<Daylight_Saving_Time_Rule ua="na">start=3/8/7;end=11/1/7;save=1</Daylight_Saving_Time_Rule>
<Proxy_1_ ua="na">p2g1m22.italkbb.com</Proxy_1_> ! This is the SIP server the ATA uses. However this name can only be resolved by italkbb's private DNS server. Instead of using the method in the above link, Use Wireshark to sniff a real call from the ATA and observe the SIP INVITE and response message, the IP address of this SIP server 208.77.2.113
<Outbound_Proxy_1_ ua="na">p2g1m22.italkbb.com</Outbound_Proxy_1_><SIP_Port_1_ ua="na">10000</SIP_Port_1_> ! Note it's not the default 5060 port
<Preferred_Codec_1_ ua="na">G729a</Preferred_Codec_1_>
!!!omitted!!!!
<Upgrade_Enable>Yes</Upgrade_Enable>
<Profile_Rule ua="na">http://cfp2g1m22.italkbb.com/customContent/GenX.dbml?MA=$MA&SWVER=$SWVER&PSN=$PSN</Profile_Rule> !This is the URL where ATA will download this profile<Syslog_Server ua="na">
</Syslog_Server><Debug_Server ua="na"></Debug_Server>
<Debug_Level ua="na">0</Debug_Level>
<Forced_Resync_Delay ua="na">7200</Forced_Resync_Delay><Resync_Periodic ua="na">7200</Resync_Periodic>
<Resync_Error_Retry_Delay ua="na">7200</Resync_Error_Retry_Delay>
<Upgrade_Error_Retry_Delay ua="na">604800</Upgrade_Error_Retry_Delay>
<Profile_Rule_B ua="na"></Profile_Rule_B><Web_Server_Port ua="na">1980</Web_Server_Port>
<Admin_Passwd ua="na">Admin password of ATA</Admin_Passwd> !username is admin
<User_Password ua="rw">1234</User_Password> !user level access password is 1234   
<Primary_DNS ua="rw">208.77.2.11</Primary_DNS> ! this is the private DNS server that's mentioned above, but we are not using it
<Secondary_DNS ua="rw">207.238.87.34</Secondary_DNS>
......
<SIP_User_Agent_Name ua="na">M22$MA$VERSION</SIP_User_Agent_Name> ! We can use this form to forge the user-agent header of Asterisk to make it the same as Linksys (M22000e08eaaab2Linksys/SPA2102-5.2.13(004))
<Enable_WAN_Web_Server ua="na">Yes</Enable_WAN_Web_Server>
<WAN_Web_Server_Port ua="na">1980</WAN_Web_Server_Port> !This is the port to refer to in the browser if need to access ATA's web gui.
<LAN_IP_Address ua="rw"/><QOS_Policy ua="rw"/>
<SIT1_RSC>S01,S02</SIT1_RSC><SIT2_RSC>R01,R02,R03,R40</SIT2_RSC>
<SIT1_Tone>397@-16,1428@-16,1777@-16;20(.380/0/1,.380/0/2,.380/0/3,0/4/0)</SIT1_Tone>
<SIT2_Tone>520@-19,507@-19;15(0/2/0,.2/.1/1,.1/2.1/2)</SIT2_Tone>
<Upgrade_Rule ua="na">(&lt;5.2.13)?http://version2113.italkbb.com/spa2102-5-2-13-004.bin</Upgrade_Rule>
</flat-profile>

2. To stop auto provisioning on ATA(so that the password will not be changed periodically), log into the ATA web gui http://ip_address:1980 then log in as admin with the above admin password, go to voice tab then provisioning tab, select no to provision enable.
Part B. AsteriskNow SIP trunk configuration
1. Go to Settings, Asterisk SIP Settings, then under NAT settings, click detect External IP,  the following info will be automatically detected.
Codecs can be configured as follows,
Then go to Chan SIP, scroll down and change 
a.)Bind port from 5060 to 10000 (otherwise the source port would always be 5060 which probably is not allowed by italkbb)
b.)SRV lookup enable
c.)Add field to Other SIP Settings, useragent = M22000e08eaaab2Linksys/SPA2102-5.2.13(004)
2. Create a new SIP Trunk with the following settings
General Settings
Trunk Name: italkbb
Outbound CallerID: can be empty
CID Options: All Any CID
Trunk Name: same as italkbb_account (899203XXXX)
PEER Details:(some settings might be unnecessary)

fromdomain=p2g1m22.italkbb.com //otherwise the from header in INVITE would have italkbb_account@internal_IP_address
username=899203XXXX
defaultuser=899203XXXX
secret=Password obtained in profile
type=friend
insecure=port,invite
context=from-trunk
dtmfmode=auto
disallow=all
allow=ulaw,alaw,g729,g723

Register String:
Note: without this /account_name portion, registration would fail with "403 forbidden No registration-plan" message. 
Contact URI would have sip:s@host instead of extension@host
If no extension is given, the 's' extension is used. The extension needs to  ; be defined in extensions.conf to be able to accept calls from this SIP proxy  ; (provider).   reference:http://doxygen.asterisk.org/trunk/Config_sip.html
After apply change, in Wireshark we should have 
Note: ATA and Asterisk are able to register at the same time. They are both able to make outbound calls but inbound calls would be affected.
3. Configure outbound and inbound routes
Go to Connectivity>Outbound Routes>Add Route
Route Name: italkbb
Route CID: italkbb_account Check Override Extension //Note: very important, otherwise the outbound call SIP INVITE would have wrong CID in from header and causing 603 Forbidden error. italkbb requires valid italkbb_account (899XXXXXXX) to present in the FROM header.
Route Positon: move to top if there are multiple
Dial Ptterns that will use this Route: add route patterns as required, prepend 1
Trunk Sequence form Matched Routes: 0 italkbb
Then submit and appl the changes
Go to Connectivity>Inbound Routes>Add Incoming Route
DID Number:italkbb_account (899XXXXXXX)
Scroll to bottom,
select Extensions: assign a preferred extension (phone) <001> cisco7960-1  //Note:here assumes extensions and phones are configured and registered already
Submit and apply changes

Saturday, October 3, 2015

Connecting SPON terminals(8530,8523,8533) and Cisco 7960 w/ SIP fw in AsteriskNow

1. Download AsteriskNow 64bit iso file and install in VMware Workstation 9.



Note: make sure internet is reachable to the VM and DNS is set correctly. Otherwise after installation the AsteriskNow would report errors and won't be able to upgrade.
(If forgot to enter the valid DNS name, after installation, edit the resolv.conf file located in the etc directory  nano /etc/resolv.conf)

2. Adding Extensions for SPON terminals in AsteriskNow




Then scroll down to the bottom and click submit button

Then click Apply Config on the top menu bar


3. Configure SPON terminals corresponding to the above settings(NAS-8530 as an example)
User Name and Password should match the User Extension and Secret respectively.


After resetting the terminal, it should register on Asterisk.

4. Allowing Video Calls on Asterisk

In top right corner, click Chan SIP

Submit change on the bottom and Apply Config on the top.

5. Hacking a Cisco 7960 phone to register to Asterisk.


5.1 Download the firmware and unzip to the tftp server's root folder
5.2 Editing the reqired conf files and xml files all under the same root folder.
Note:The correct name of xmldefault file is: XMLDefault.cnf.xml

SEP000D653398AF.cnf.xml
 <device>
<loadInformation model="IP Phone 7960">P0S3-08-11-00</loadInformation>
</device>

XMLDefault.cnf.xml (note the highlighted lines and its meaning)
<Default>
  <callManagerGroup>
     <members>
        <member priority="0">
           <callManager>
              <ports>
                 <ethernetPhonePort>2000</ethernetPhonePort>
                 <mgcpPorts>
                    <listen>2427</listen>
                    <keepAlive>2428</keepAlive>
                 </mgcpPorts>
              </ports>
              <processNodeName></processNodeName>
           </callManager>
        </member>
     </members>
  </callManagerGroup>
  <loadInformation7  model="Cisco 7960">P0S3-08-11-00</loadInformation7>
<authenticationURL></authenticationURL>
 <directoryURL></directoryURL>
 <idleURL></idleURL>
 <informationURL></informationURL>
 <messagesURL></messagesURL>
 <servicesURL></servicesURL>
</Default>

SIPDefault.cnf (note the highlighted lines and its meaning)
image_version: P0S3-08-11-00
proxy1_address: "10.0.1.31"            ; Can be dotted IP or FQDN, this is the IPPBX server addr.
proxy2_address: ""              ; Can be dotted IP or FQDN
proxy3_address: ""              ; Can be dotted IP or FQDN
proxy4_address: ""              ; Can be dotted IP or FQDN
proxy5_address: ""              ; Can be dotted IP or FQDN
proxy6_address: ""              ; Can be dotted IP or FQDN
proxy_register: 1
messages_uri:   "1"
phone_password: "cisco" ; Limited to 31 characters (Default - cisco)
sntp_mode: unicast
sntp_server: "10.0.1.2"             ;This is the working NTP server
time_zone: "GMT" ; assuming you're in GMT
time_format_24hr: 1 ; to show the time in 24hour format
date_format: "Y/M/D"  ; format you would like the date in
dial_template: dialplan

SIP000D653398AF.cnf(note the highlighted lines and each meaning)
image_version: P0S3-08-11-00
line1_name: 001
line1_authname: "001"
line1_shortname: "Line 1" ; displayed on the phones softkey
line1_password: "cisco7960"
line1_displayname: "cisco7960-1"; the caller id
proxy1_port: 5060
proxy1_address: 10.0.1.31
# Line 2 Setup
line2_name: 002
line2_authname: "002"
line2_shortname: "cisco7960-line2"
line2_password: "cisco7960"
line2_displayname: "cisco7960-2";
# Phone Label (Text desired to be displayed in upper right corner)
phone_label: "SPON.COM.CN  " ; add a space at the end, looks neater
phone_password: "cisco" ; Limited to 31 characters (Default - cisco)
user_info: none
telnet_level: 2

5.3 Configure the Asterisk's extension's accordingly.
Based on the above settings on the phone, we have two DN's , 001 and 002, and passwords are both cisco7960...

5.4 Manually configure the phone's network setting so that it points to a specific TFTP server (my laptop running Tfpd64). the phone should find its firmware and go through an upgrade
5.5 After the upgrade, the phone should register
After the above steps, the phone and terminals should be able to make calls to each other, as well as making conf. calls from the Cisco phone