Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Cisco 797X settings #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions setup/db/update/endpointconfig/version_sql/6_2.5.0-3_2.5.0-4.sql
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,27 @@ INSERT INTO `model_properties` (`id_model`, `property_key`, `property_value`) VA
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "CiscoSPA" AND model.name = "SPA303G"), 'max_iax2_accounts', '0'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "CiscoSPA" AND model.name = "SPA303G"), 'http_username', 'admin'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "CiscoSPA" AND model.name = "SPA303G"), 'http_password', '22222');

/* Creación del fabricante Cisco 797X */
INSERT INTO `manufacturer` (`name`, `description`) VALUES ('Cisco797X', 'Cisco797X');

INSERT INTO `mac_prefix` (`id_manufacturer`, `mac_prefix`, `description`) VALUES
((SELECT `id` FROM manufacturer WHERE `name` = "Cisco797X"), '00:1F:6C', 'Cisco SPA7961G'),
((SELECT `id` FROM manufacturer WHERE `name` = "Cisco797X"), '00:1F:9E', 'Cisco SPA7961G'),
((SELECT `id` FROM manufacturer WHERE `name` = "Cisco797X"), '00:E1:6D', 'Cisco SPA9951');

/* Modelos asociados a Cisco797X */
INSERT INTO `model` (`id_manufacturer`, `name`, `description`, `max_accounts`, `static_ip_supported`, `dynamic_ip_supported`, `static_prov_supported`) VALUES
((SELECT `id` FROM manufacturer WHERE `name` = "Cisco797X"), 'SPA7961G', 'SPA7961G', '3', '1', '1', '0'),
((SELECT `id` FROM manufacturer WHERE `name` = "Cisco797X"), 'SPA9951', 'SPA9951', '3', '1', '1', '0');

/* Propiedades de los modelos Cisco 797X */
INSERT INTO `model_properties` (`id_model`, `property_key`, `property_value`) VALUES
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA7961G"), 'max_sip_accounts', '3'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA7961G"), 'max_iax2_accounts', '0'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA7961G"), 'http_username', 'admin'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA7961G"), 'http_password', 'cisco'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA9951"), 'max_sip_accounts', '3'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA9951"), 'max_iax2_accounts', '0'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA9951"), 'http_username', 'admin'),
((SELECT model.id FROM manufacturer, model WHERE manufacturer.id = model.id_manufacturer AND manufacturer.name = "Cisco797X" AND model.name = "SPA9951"), 'http_password', 'cisco');
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def __init__(self, dbconn, tech, exten):
setattr(self, 'server_port', row[0])
sth.execute(
'SELECT property_key, property_value ' +
'FROM endpoint_account_properties, endpoint_account ' +
'WHERE endpoint_account_properties.id_endpoint_account = endpoint_account.id ' +
'FROM endpoint_properties, endpoint_account ' +
'WHERE endpoint_properties.id_endpoint = endpoint_account.id_endpoint ' +
'AND endpoint_account.account = %s',
(exten,))
for row in sth.fetchall():
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# vim: set fileencoding=utf-8 :
# vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
# Codificación: UTF-8
# +----------------------------------------------------------------------+
# | Issabel version 4.0.4 |
# | http://www.issabel.org |
# +----------------------------------------------------------------------+
# | Copyright (c) 2006 Palosanto Solutions S. A. |
# +----------------------------------------------------------------------+
# | Cdla. Nueva Kennedy Calle E 222 y 9na. Este |
# | Telfs. 2283-268, 2294-440, 2284-356 |
# | Guayaquil - Ecuador |
# | http://www.palosanto.com |
# +----------------------------------------------------------------------+
# | The contents of this file are subject to the General Public License |
# | (GPL) Version 2 (the "License"); you may not use this file except in |
# | compliance with the License. You may obtain a copy of the License at |
# | http://www.opensource.org/licenses/gpl-license.php |
# | |
# | Software distributed under the License is distributed on an "AS IS" |
# | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See |
# | the License for the specific language governing rights and |
# | limitations under the License. |
# +----------------------------------------------------------------------+
# | The Initial Developer of the Original Code is PaloSanto Solutions |
# | CiscoSPA.py file forked from Linksys.py by Bob Fryer 07/06/2015 |
# | Other modifications made : |
# | * Added code to convert GMT Offsite into format for Cisco SPA Phones |
# | * added timezone as a parameter that can be set in the Endpoint GUI |
# | * made modifications to utilse the CiscoSPA replacing Linksys name |
# | * added published variables daylightrule and daylightenable |
# | * Created Cisco_local_spa.tpl file from Linksys template file |
# +----------------------------------------------------------------------+
# $Id: dialerd,v 1.2 2008/09/08 18:29:36 alex Exp $
import logging
from issabel.BaseEndpoint import BaseEndpoint
from eventlet.green import urllib2, socket

class Endpoint(BaseEndpoint):
def __init__(self, amipool, dbpool, sServerIP, sIP, mac):
BaseEndpoint.__init__(self, 'Cisco797X', amipool, dbpool, sServerIP, sIP, mac)

# Convert Signed Decimal TimeZone Offset to Signed HH:MM offset formated for Cisco SPA Phones
tzoffset = BaseEndpoint.getTimezoneOffset() / 60
self._timeZone = ''
if tzoffset < 0:
self._timeZone = 'GMT-'
else:
self._timeZone = 'GMT+'
self._timeZone = self._timeZone + ('%02d:%02d' % (abs(tzoffset) / 60, abs(tzoffset) % 60))
self._daylightrule = ''
self._daylightenable = ''


def setExtraParameters(self, param):
if not BaseEndpoint.setExtraParameters(self, param): return False
if 'timezone' in param: self._timeZone = param['timezone']
if 'daylightrule' in param: self._daylightrule = param['daylightrule']
if 'daylightenable' in param: self._daylightenable = param['daylightenable']
return True

def updateLocalConfig(self):
'''Configuration for Cisco797X endpoints (local):

A file called SPAXXXXXXXXXXXX.cnf.xml should be created with the XML
configuration for the endpoint. The XXXXXXXXXXXX should be replaced with
the uppercase version of the MAC address of the endpoint. To reboot and
refresh the configuration, an HTTP GET request is performed to the URL:
http://{$IP}/admin/resync?{$SERVER_IP}/spaXXXXXXXXXXXX.cfg, again
replacing XXXXXXXXXXXX with the MAC address.
'''
# Check that there is at least one account to configure
if len(self._accounts) <= 0:
logging.error('Endpoint %s@%s has no accounts to configure' %
(self._vendorname, self._ip))
return False

# Need to calculate lowercase version of MAC address without colons
sConfigFile = 'SEP' + (self._mac.replace(':', '').upper()) + '.cnf.xml'
sConfigPath = self._tftpdir + '/' + sConfigFile
vars = self._prepareVarList()
vars['config_filename'] = sConfigFile
vars.update({
'time_zone' : self._timeZone,
'daylight_rule' : self._daylightrule,
'daylight_enable' : self._daylightenable,
})

try:
self._writeTemplate('Cisco_local_797X.tpl', vars, sConfigPath)
except IOError, e:
logging.error('Endpoint %s@%s failed to write configuration file - %s' %
(self._vendorname, self._ip, str(e)))
return False

# Reboot the phone.
try:
# Open connection to execute resync.
# TODO: what, no authentication?
r = urllib2.urlopen('http://' + self._ip + '/admin/resync?' + self._serverip + '/' + sConfigFile)
r.read()
except urllib2.HTTPError, e:
logging.error('Endpoint %s@%s got HTTP Error - %s' %
(self._vendorname, self._ip, str(e)))
return False
except urllib2.URLError, e:
logging.error('Endpoint %s@%s failed to connect - %s' %
(self._vendorname, self._ip, str(e)))
return False
except socket.error, e:
logging.error('Endpoint %s@%s failed to connect - %s' %
(self._vendorname, self._ip, str(e)))
return False

self._unregister()
self._setConfigured()
return True

219 changes: 219 additions & 0 deletions setup/usr/share/issabel/endpoint-classes/tpl/Cisco_local_797X.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<device>
<fullConfig>true</fullConfig>
<deviceProtocol>SIP</deviceProtocol>

<sshUserId>cisco</sshUserId>
<sshPassword>cisco</sshPassword>

<devicePool>
<dateTimeSetting>
<dateTemplate>M-D-YYYYA</dateTemplate>
<timeZone>Eastern Standard/Daylight Time</timeZone>
<ntps>
<ntp>
<name>{{server_ip}}</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>{{server_ip}}</processNodeName>
</callManager>
</member>
</members>
</callManagerGroup>
</devicePool>

<sipProfile>
<sipProxies>
<backupProxy></backupProxy>
<backupProxyPort></backupProxyPort>
<emergencyProxy></emergencyProxy>
<emergencyProxyPort></emergencyProxyPort>
<outboundProxy></outboundProxy>
<outboundProxyPort></outboundProxyPort>
<registerWithProxy>true</registerWithProxy>
</sipProxies>

<sipCallFeatures>
<cnfJoinEnabled>true</cnfJoinEnabled>
<callForwardURI>x-cisco-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>1</callHoldRingback>
<localCfwdEnable>true</localCfwdEnable>
<semiAttendedTransfer>true</semiAttendedTransfer>
<anonymousCallBlock>0</anonymousCallBlock>
<callerIdBlocking>0</callerIdBlocking>
<retainForwardInformation>false</retainForwardInformation>
<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>true</remotePartyID>
<userInfo>Phone</userInfo>
</sipStack>

<autoAnswerTimer>1</autoAnswerTimer>
<autoAnswerAltBehavior>false</autoAnswerAltBehavior>
<autoAnswerOverride>true</autoAnswerOverride>
<transferOnhookEnabled>false</transferOnhookEnabled>
<enableVad>false</enableVad>
<preferredCodec>none</preferredCodec>
<dtmfAvtPayload>101</dtmfAvtPayload>
<dtmfDbLevel>3</dtmfDbLevel>
<dtmfOutofBand>avt</dtmfOutofBand>
<alwaysUsePrimeLine>false</alwaysUsePrimeLine>
<alwaysUsePrimeLineVoiceMail>false</alwaysUsePrimeLineVoiceMail>
<kpml>0</kpml>

<natEnabled>false</natEnabled>
<natReceivedProcessing>false</natReceivedProcessing>
<natAddress></natAddress>

<phoneLabel>CentroNia MD</phoneLabel>
<stutterMsgWaiting>0</stutterMsgWaiting>
<callStats>true</callStats>
<offhookToFirstDigitTimer>15000</offhookToFirstDigitTimer>
<silentPeriodBetweenCallWaitingBursts>10</silentPeriodBetweenCallWaitingBursts>
<disableLocalSpeedDialConfig>false</disableLocalSpeedDialConfig>

<startMediaPort>16384</startMediaPort>
<stopMediaPort>20000</stopMediaPort>

<sipLines>
{{py:n = 1}}{{for extension in sip}}
<line button="{{n}}" lineindex="{{n}}">
<featureID>9</featureID>
<featureLabel>{{extension.extension}}</featureLabel>
<proxy>USECALLMANAGER</proxy>
<port>5060</port>
<name>{{extension.extension}}</name>
<displayName>{{extension.description}}</displayName>
<autoAnswer>
<autoAnswerEnabled>0</autoAnswerEnabled>
</autoAnswer>
<callWaiting>1</callWaiting>
<authName>{{extension.account}}</authName>
<authPassword>{{extension.secret}}</authPassword>
<sharedLine>false</sharedLine>
<messageWaitingLampPolicy>3</messageWaitingLampPolicy>
<messageWaitingAMWI>0</messageWaitingAMWI>
<messagesNumber>*97</messagesNumber>
<ringSettingIdle>4</ringSettingIdle>
<ringSettingActive>5</ringSettingActive>
<contact></contact>
<forwardCallInfoDisplay>
<callerName>true</callerName>
<callerNumber>false</callerNumber>
<redirectedNumber>false</redirectedNumber>
<dialedNumber>true</dialedNumber>
</forwardCallInfoDisplay>
</line>
{{py:n += 1}}{{endfor}}
</sipLines>

<voipControlPort>5060</voipControlPort>
<dscpForAudio>184</dscpForAudio>
<ringSettingBusyStationPolicy>0</ringSettingBusyStationPolicy>
<dialTemplate>dialplan.xml</dialTemplate>

</sipProfile>

<commonProfile>
<phonePassword></phonePassword>
<backgroundImageAccess>true</backgroundImageAccess>
<callLogBlfEnabled>2</callLogBlfEnabled>
</commonProfile>

<vendorConfig>
<defaultWallpaperFile>IMAGE2.png</defaultWallpaperFile>
<disableSpeaker>false</disableSpeaker>
<disableSpeakerAndHeadset>false</disableSpeakerAndHeadset>
<pcPort>0</pcPort>
<settingsAccess>1</settingsAccess>
<garp>0</garp>
<voiceVlanAccess>0</voiceVlanAccess>
<videoCapability>0</videoCapability>
<autoSelectLineEnable>0</autoSelectLineEnable>
<sshAccess>0</sshAccess>
<sshPort>22</sshPort>
<webAccess>0</webAccess>
<daysDisplayNotActive>1,7</daysDisplayNotActive>
<displayOnTime>08:00</displayOnTime>
<displayOnDuration>10:00</displayOnDuration>
<displayIdleTimeout>00:15</displayIdleTimeout>
<spanToPCPort>1</spanToPCPort>
<loggingDisplay>1</loggingDisplay>
<loadServer></loadServer>
</vendorConfig>

<userLocale>
<name>America/Sao_Paulo</name>
<uid>1</uid>
<langCode>pt_BR</langCode>
<version>1.0.0.0-1</version>
<winCharSet>UTF-8</winCharSet>
</userLocale>

<networkLocale>America/Sao_Paulo</networkLocale>

<networkLocaleInfo>
<name>America/Sao_Paulo</name>
<version>5.0(2)</version>
</networkLocaleInfo>

<deviceSecurityMode>1</deviceSecurityMode>

<authenticationURL></authenticationURL>
<directoryURL></directoryURL>
<idleURL></idleURL>
<informationURL></informationURL>

<messagesURL></messagesURL>
<proxyServerURL></proxyServerURL>
<servicesURL></servicesURL>

<dscpForSCCPPhoneConfig>96</dscpForSCCPPhoneConfig>
<dscpForSCCPPhoneServices>0</dscpForSCCPPhoneServices>
<dscpForCm2Dvce>96</dscpForCm2Dvce>

<transportLayerProtocol>2</transportLayerProtocol>

<capfAuthMode>0</capfAuthMode>
<capfList>
<capf>
<phonePort>3804</phonePort>
</capf>
</capfList>

<certHash></certHash>
<encrConfig>false</encrConfig>

</device>