Yealink Forums

Full Version: V73 Remote Control Forwarding T41
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
We have installations with T41 and T46. Because the T41 has no forwarding key I made a small python script to Control to set that on the T41.

The problem is that the script is not working anymore on V73. Is there a better way to do that on V73 or any hint what can I do?

Thank you

def set_forward(phoneip, status=0, number='', password='admin'):
"""
Used to enable and disable the always forward settings.
We connect to the phone like a webbrowser and send the key/values via POST

phoneip = ip address of the yealink phone
status = 0=off 1=on
number = destination phone number
password = admin password for the web ui
"""
import cookielib, urllib2, urllib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders.append(('User-agent', 'Mozilla/4.0'))
referer = 'http://%s/servlet?p=login&q=loginForm&jumpto=status' % phoneip
opener.addheaders.append(('Referer', referer))
login_values = {'username' : 'admin',
'pwd' : password,
'acc' : '',
'jumpto' : 'status'
}
login_data = urllib.urlencode(login_values)
# do the first login
url = 'http://%s/servlet?p=login&q=login' % phoneip
resp = opener.open(url, login_data)

"""
values = {'ForwardMode': '0',
'AlwaysForwardSwitch': status,
'AlwaysForwardTarget': number,
'AlwaysForwardOnCode': '',
'AlwaysForwardOffCode': '*754',
'BusyForwardSwitch': '0',
'BusyForwardTarget': '',
'BusyForwardOnCode': '',
'BusyForwardOffCode': '',
'NoAnswerForwardSwitch': '0',
'NoAnswerForwardDelayTime': '2',
'NoAnswerForwardTarget': '',
'NoAnswerForwardOnCode': '',
'NoAnswerForwardOffCode': '',
'DNDEmergencySwitch': '0',
'DNDEmergencyNumberList': '',
'DndMode': '0',
'DndStatus': '0',
'DndOnCode': '',
'DndOffCode': ''}"""
values = {'ForwardMode': '0',
'AlwaysForwardSwitch': status
}
if number != '':
values['AlwaysForwardTarget'] = number
data = urllib.urlencode(values)
# send cmd
url = 'http://%s/servlet?p=features-forward&q=write&fwd=0&dnd=0' % phoneip
resp = opener.open(url, data)
We haven't tested this way, please check thred 3390.

Regards,
James
Reference URL's