| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
import sys |
| 21 |
if sys.version_info[0] >= 3: |
| 22 |
import tkinter as tk |
| 23 |
from tkinter import ttk |
| 24 |
from tkinter import messagebox as msgbox |
| 25 |
else: |
| 26 |
import Tkinter as tk |
| 27 |
import tkMessageBox as msgbox |
| 28 |
import ttk |
| 29 |
|
| 30 |
import pjsua2 as pj |
| 31 |
import endpoint |
| 32 |
import application |
| 33 |
|
| 34 |
class Dialog(tk.Toplevel): |
| 35 |
""" |
| 36 |
This implements account settings dialog to manipulate account settings. |
| 37 |
""" |
| 38 |
def __init__(self, parent, cfg): |
| 39 |
tk.Toplevel.__init__(self, parent) |
| 40 |
self.transient(parent) |
| 41 |
self.parent = parent |
| 42 |
self.geometry("+100+100") |
| 43 |
self.title('Account settings') |
| 44 |
|
| 45 |
self.frm = ttk.Frame(self) |
| 46 |
self.frm.pack(expand='yes', fill='both') |
| 47 |
|
| 48 |
self.isOk = False |
| 49 |
self.cfg = cfg |
| 50 |
|
| 51 |
self.createWidgets() |
| 52 |
|
| 53 |
def doModal(self): |
| 54 |
if self.parent: |
| 55 |
self.parent.wait_window(self) |
| 56 |
else: |
| 57 |
self.wait_window(self) |
| 58 |
return self.isOk |
| 59 |
|
| 60 |
def createWidgets(self): |
| 61 |
|
| 62 |
self.frm.rowconfigure(0, weight=1) |
| 63 |
self.frm.rowconfigure(1, weight=0) |
| 64 |
self.frm.columnconfigure(0, weight=1) |
| 65 |
self.frm.columnconfigure(1, weight=1) |
| 66 |
self.wTab = ttk.Notebook(self.frm) |
| 67 |
self.wTab.grid(column=0, row=0, columnspan=2, padx=10, pady=10, ipadx=20, ipady=20, sticky=tk.N+tk.S+tk.W+tk.E) |
| 68 |
|
| 69 |
|
| 70 |
btnOk = ttk.Button(self.frm, text='Ok', command=self.onOk) |
| 71 |
btnOk.grid(column=0, row=1, sticky=tk.E, padx=20, pady=10) |
| 72 |
btnCancel = ttk.Button(self.frm, text='Cancel', command=self.onCancel) |
| 73 |
btnCancel.grid(column=1, row=1, sticky=tk.W, padx=20, pady=10) |
| 74 |
|
| 75 |
|
| 76 |
self.createBasicTab() |
| 77 |
self.createSipTab() |
| 78 |
self.createMediaTab() |
| 79 |
self.createMediaNatTab() |
| 80 |
|
| 81 |
def createBasicTab(self): |
| 82 |
|
| 83 |
self.cfgPriority = tk.IntVar(value=self.cfg.priority) |
| 84 |
self.cfgAccId = tk.StringVar(value=self.cfg.idUri) |
| 85 |
self.cfgRegistrar = tk.StringVar(value=self.cfg.regConfig.registrarUri) |
| 86 |
self.cfgRegisterOnAdd = tk.BooleanVar(value=self.cfg.regConfig.registerOnAdd) |
| 87 |
self.cfgUsername = tk.StringVar() |
| 88 |
self.cfgPassword = tk.StringVar() |
| 89 |
if len(self.cfg.sipConfig.authCreds): |
| 90 |
self.cfgUsername.set( self.cfg.sipConfig.authCreds[0].username ) |
| 91 |
self.cfgPassword.set( self.cfg.sipConfig.authCreds[0].data ) |
| 92 |
self.cfgProxy = tk.StringVar() |
| 93 |
if len(self.cfg.sipConfig.proxies): |
| 94 |
self.cfgProxy.set( self.cfg.sipConfig.proxies[0] ) |
| 95 |
|
| 96 |
|
| 97 |
frm = ttk.Frame(self.frm) |
| 98 |
frm.columnconfigure(0, weight=1) |
| 99 |
frm.columnconfigure(1, weight=2) |
| 100 |
row = 0 |
| 101 |
ttk.Label(frm, text='Priority:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 102 |
tk.Spinbox(frm, from_=0, to=9, textvariable=self.cfgPriority, width=2).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 103 |
row += 1 |
| 104 |
ttk.Label(frm, text='ID (URI):').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 105 |
ttk.Entry(frm, textvariable=self.cfgAccId, width=32).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 106 |
row += 1 |
| 107 |
ttk.Label(frm, text='Registrar URI:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 108 |
ttk.Entry(frm, textvariable=self.cfgRegistrar, width=32).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 109 |
row += 1 |
| 110 |
ttk.Checkbutton(frm, text='Register on add', variable=self.cfgRegisterOnAdd).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 111 |
row += 1 |
| 112 |
ttk.Label(frm, text='Optional proxy URI:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 113 |
ttk.Entry(frm, textvariable=self.cfgProxy, width=32).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 114 |
row += 1 |
| 115 |
ttk.Label(frm, text='Auth username:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 116 |
ttk.Entry(frm, textvariable=self.cfgUsername, width=16).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 117 |
row += 1 |
| 118 |
ttk.Label(frm, text='Password:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 119 |
ttk.Entry(frm, textvariable=self.cfgPassword, show='*', width=16).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 120 |
|
| 121 |
self.wTab.add(frm, text='Basic Settings') |
| 122 |
|
| 123 |
|
| 124 |
def createSipTab(self): |
| 125 |
|
| 126 |
self.cfgPrackUse = tk.IntVar(value=self.cfg.callConfig.prackUse) |
| 127 |
self.cfgTimerUse = tk.IntVar(value=self.cfg.callConfig.timerUse) |
| 128 |
self.cfgTimerExpires = tk.IntVar(value=self.cfg.callConfig.timerSessExpiresSec) |
| 129 |
self.cfgPublish = tk.BooleanVar(value=self.cfg.presConfig.publishEnabled) |
| 130 |
self.cfgMwiEnabled = tk.BooleanVar(value=self.cfg.mwiConfig.enabled) |
| 131 |
self.cfgEnableContactRewrite = tk.BooleanVar(value=self.cfg.natConfig.contactRewriteUse != 0) |
| 132 |
self.cfgEnableViaRewrite = tk.BooleanVar(value=self.cfg.natConfig.viaRewriteUse != 0) |
| 133 |
self.cfgEnableSdpRewrite = tk.BooleanVar(value=self.cfg.natConfig.sdpNatRewriteUse != 0) |
| 134 |
self.cfgEnableSipOutbound = tk.BooleanVar(value=self.cfg.natConfig.sipOutboundUse != 0) |
| 135 |
self.cfgKaInterval = tk.IntVar(value=self.cfg.natConfig.udpKaIntervalSec) |
| 136 |
|
| 137 |
|
| 138 |
frm = ttk.Frame(self.frm) |
| 139 |
frm.columnconfigure(0, weight=1) |
| 140 |
frm.columnconfigure(1, weight=2) |
| 141 |
row = 0 |
| 142 |
ttk.Label(frm, text='100rel/PRACK:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 143 |
ttk.Radiobutton(frm, text='Only offer PRACK', value=pj.PJSUA_100REL_NOT_USED, variable=self.cfgPrackUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 144 |
row += 1 |
| 145 |
ttk.Radiobutton(frm, text='Offer and use if remote supports', value=pj.PJSUA_100REL_OPTIONAL, variable=self.cfgPrackUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 146 |
row += 1 |
| 147 |
ttk.Radiobutton(frm, text='Required', value=pj.PJSUA_100REL_MANDATORY, variable=self.cfgPrackUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 148 |
row += 1 |
| 149 |
ttk.Label(frm, text='Session Timer:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 150 |
ttk.Radiobutton(frm, text='Not offered', value=pj.PJSUA_SIP_TIMER_INACTIVE, variable=self.cfgTimerUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 151 |
row += 1 |
| 152 |
ttk.Radiobutton(frm, text='Optional', value=pj.PJSUA_SIP_TIMER_OPTIONAL, variable=self.cfgTimerUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 153 |
row += 1 |
| 154 |
ttk.Radiobutton(frm, text='Required', value=pj.PJSUA_SIP_TIMER_REQUIRED, variable=self.cfgTimerUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 155 |
row += 1 |
| 156 |
ttk.Radiobutton(frm, text="Always use", value=pj.PJSUA_SIP_TIMER_ALWAYS, variable=self.cfgTimerUse).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 157 |
row += 1 |
| 158 |
ttk.Label(frm, text='Session Timer Expiration:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 159 |
tk.Spinbox(frm, from_=90, to=7200, textvariable=self.cfgTimerExpires, width=5).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 160 |
ttk.Label(frm, text='(seconds)').grid(row=row, column=1, sticky=tk.E) |
| 161 |
row += 1 |
| 162 |
ttk.Label(frm, text='Presence:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 163 |
ttk.Checkbutton(frm, text='Enable PUBLISH', variable=self.cfgPublish).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 164 |
row += 1 |
| 165 |
ttk.Label(frm, text='Message Waiting Indication:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 166 |
ttk.Checkbutton(frm, text='Enable MWI', variable=self.cfgMwiEnabled).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 167 |
row += 1 |
| 168 |
ttk.Label(frm, text='NAT Traversal:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 169 |
ttk.Checkbutton(frm, text='Enable Contact Rewrite', variable=self.cfgEnableContactRewrite).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 170 |
row += 1 |
| 171 |
ttk.Checkbutton(frm, text='Enable Via Rewrite', variable=self.cfgEnableViaRewrite).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 172 |
row += 1 |
| 173 |
ttk.Checkbutton(frm, text='Enable SDP IP Address Rewrite', variable=self.cfgEnableSdpRewrite).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 174 |
row += 1 |
| 175 |
ttk.Checkbutton(frm, text='Enable SIP Outbound Extension', variable=self.cfgEnableSipOutbound).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 176 |
row += 1 |
| 177 |
ttk.Label(frm, text='UDP Keep-Alive Interval:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 178 |
tk.Spinbox(frm, from_=0, to=3600, textvariable=self.cfgKaInterval, width=5).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 179 |
ttk.Label(frm, text='(seconds) Zero to disable.').grid(row=row, column=1, sticky=tk.E) |
| 180 |
|
| 181 |
|
| 182 |
self.wTab.add(frm, text='SIP Features') |
| 183 |
|
| 184 |
def createMediaTab(self): |
| 185 |
|
| 186 |
self.cfgMedPort = tk.IntVar(value=self.cfg.mediaConfig.transportConfig.port) |
| 187 |
self.cfgMedPortRange = tk.IntVar(value=self.cfg.mediaConfig.transportConfig.portRange) |
| 188 |
self.cfgMedLockCodec = tk.BooleanVar(value=self.cfg.mediaConfig.lockCodecEnabled) |
| 189 |
self.cfgMedSrtp = tk.IntVar(value=self.cfg.mediaConfig.srtpUse) |
| 190 |
self.cfgMedSrtpSecure = tk.IntVar(value=self.cfg.mediaConfig.srtpSecureSignaling) |
| 191 |
self.cfgMedIpv6 = tk.BooleanVar(value=self.cfg.mediaConfig.ipv6Use==pj.PJSUA_IPV6_ENABLED) |
| 192 |
|
| 193 |
|
| 194 |
frm = ttk.Frame(self.frm) |
| 195 |
frm.columnconfigure(0, weight=1) |
| 196 |
frm.columnconfigure(1, weight=21) |
| 197 |
row = 0 |
| 198 |
ttk.Label(frm, text='Secure RTP (SRTP):').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 199 |
ttk.Radiobutton(frm, text='Disable', value=pj.PJMEDIA_SRTP_DISABLED, variable=self.cfgMedSrtp).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 200 |
row += 1 |
| 201 |
ttk.Radiobutton(frm, text='Mandatory', value=pj.PJMEDIA_SRTP_MANDATORY, variable=self.cfgMedSrtp).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 202 |
row += 1 |
| 203 |
ttk.Radiobutton(frm, text='Optional (non-standard)', value=pj.PJMEDIA_SRTP_OPTIONAL, variable=self.cfgMedSrtp).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 204 |
row += 1 |
| 205 |
ttk.Label(frm, text='SRTP signaling:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 206 |
ttk.Radiobutton(frm, text='Does not require secure signaling', value=0, variable=self.cfgMedSrtpSecure).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 207 |
row += 1 |
| 208 |
ttk.Radiobutton(frm, text='Require secure next hop (TLS)', value=1, variable=self.cfgMedSrtpSecure).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 209 |
row += 1 |
| 210 |
ttk.Radiobutton(frm, text='Require secure end-to-end (SIPS)', value=2, variable=self.cfgMedSrtpSecure).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 211 |
row += 1 |
| 212 |
ttk.Label(frm, text='RTP transport start port:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 213 |
tk.Spinbox(frm, from_=0, to=65535, textvariable=self.cfgMedPort, width=5).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 214 |
ttk.Label(frm, text='(0: any)').grid(row=row, column=1, sticky=tk.E, pady=2) |
| 215 |
row += 1 |
| 216 |
ttk.Label(frm, text='Port range:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 217 |
tk.Spinbox(frm, from_=0, to=65535, textvariable=self.cfgMedPortRange, width=5).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 218 |
ttk.Label(frm, text='(0: not limited)').grid(row=row, column=1, sticky=tk.E, pady=2) |
| 219 |
row += 1 |
| 220 |
ttk.Label(frm, text='Lock codec:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 221 |
ttk.Checkbutton(frm, text='Enable', variable=self.cfgMedLockCodec).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 222 |
row += 1 |
| 223 |
ttk.Label(frm, text='Use IPv6:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 224 |
ttk.Checkbutton(frm, text='Yes', variable=self.cfgMedIpv6).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 225 |
|
| 226 |
self.wTab.add(frm, text='Media settings') |
| 227 |
|
| 228 |
def createMediaNatTab(self): |
| 229 |
|
| 230 |
self.cfgSipUseStun = tk.IntVar(value = self.cfg.natConfig.sipStunUse) |
| 231 |
self.cfgMediaUseStun = tk.IntVar(value = self.cfg.natConfig.mediaStunUse) |
| 232 |
self.cfgIceEnabled = tk.BooleanVar(value = self.cfg.natConfig.iceEnabled) |
| 233 |
self.cfgIceAggressive = tk.BooleanVar(value = self.cfg.natConfig.iceAggressiveNomination) |
| 234 |
self.cfgAlwaysUpdate = tk.BooleanVar(value = True if self.cfg.natConfig.iceAlwaysUpdate else False) |
| 235 |
self.cfgIceNoHostCands = tk.BooleanVar(value = True if self.cfg.natConfig.iceMaxHostCands == 0 else False) |
| 236 |
self.cfgTurnEnabled = tk.BooleanVar(value = self.cfg.natConfig.turnEnabled) |
| 237 |
self.cfgTurnServer = tk.StringVar(value = self.cfg.natConfig.turnServer) |
| 238 |
self.cfgTurnConnType = tk.IntVar(value = self.cfg.natConfig.turnConnType) |
| 239 |
self.cfgTurnUser = tk.StringVar(value = self.cfg.natConfig.turnUserName) |
| 240 |
self.cfgTurnPasswd = tk.StringVar(value = self.cfg.natConfig.turnPassword) |
| 241 |
|
| 242 |
|
| 243 |
frm = ttk.Frame(self.frm) |
| 244 |
frm.columnconfigure(0, weight=1) |
| 245 |
frm.columnconfigure(1, weight=2) |
| 246 |
row = 0 |
| 247 |
ttk.Label(frm, text='SIP STUN Usage:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 248 |
ttk.Radiobutton(frm, text='Default', value=pj.PJSUA_STUN_USE_DEFAULT, variable=self.cfgSipUseStun).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 249 |
row += 1 |
| 250 |
ttk.Radiobutton(frm, text='Disable', value=pj.PJSUA_STUN_USE_DISABLED, variable=self.cfgSipUseStun).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 251 |
row += 1 |
| 252 |
ttk.Label(frm, text='Media STUN Usage:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 253 |
ttk.Radiobutton(frm, text='Default', value=pj.PJSUA_STUN_USE_DEFAULT, variable=self.cfgMediaUseStun).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 254 |
row += 1 |
| 255 |
ttk.Radiobutton(frm, text='Disable', value=pj.PJSUA_STUN_USE_DISABLED, variable=self.cfgMediaUseStun).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 256 |
row += 1 |
| 257 |
ttk.Label(frm, text='ICE:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 258 |
ttk.Checkbutton(frm, text='Enable', variable=self.cfgIceEnabled).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 259 |
row += 1 |
| 260 |
ttk.Checkbutton(frm, text='Use aggresive nomination', variable=self.cfgIceAggressive).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 261 |
row += 1 |
| 262 |
ttk.Checkbutton(frm, text='Always re-INVITE after negotiation', variable=self.cfgAlwaysUpdate).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 263 |
row += 1 |
| 264 |
ttk.Checkbutton(frm, text='Disable host candidates', variable=self.cfgIceNoHostCands).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 265 |
row += 1 |
| 266 |
ttk.Label(frm, text='TURN:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 267 |
ttk.Checkbutton(frm, text='Enable', variable=self.cfgTurnEnabled).grid(row=row, column=1, sticky=tk.W, padx=6, pady=2) |
| 268 |
row += 1 |
| 269 |
ttk.Label(frm, text='TURN server:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 270 |
ttk.Entry(frm, textvariable=self.cfgTurnServer, width=20).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 271 |
ttk.Label(frm, text='host[:port]').grid(row=row, column=1, sticky=tk.E, pady=6) |
| 272 |
row += 1 |
| 273 |
ttk.Label(frm, text='TURN connection:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 274 |
ttk.Radiobutton(frm, text='UDP', value=pj.PJ_TURN_TP_UDP, variable=self.cfgTurnConnType).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 275 |
row += 1 |
| 276 |
ttk.Radiobutton(frm, text='TCP', value=pj.PJ_TURN_TP_TCP, variable=self.cfgTurnConnType).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 277 |
row += 1 |
| 278 |
ttk.Label(frm, text='TURN username:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 279 |
ttk.Entry(frm, textvariable=self.cfgTurnUser, width=16).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 280 |
row += 1 |
| 281 |
ttk.Label(frm, text='TURN password:').grid(row=row, column=0, sticky=tk.E, pady=2) |
| 282 |
ttk.Entry(frm, textvariable=self.cfgTurnPasswd, show='*', width=16).grid(row=row, column=1, sticky=tk.W, padx=6) |
| 283 |
|
| 284 |
self.wTab.add(frm, text='NAT settings') |
| 285 |
|
| 286 |
def onOk(self): |
| 287 |
|
| 288 |
errors = ""; |
| 289 |
if not self.cfgAccId.get(): |
| 290 |
errors += "Account ID is required\n" |
| 291 |
if self.cfgAccId.get(): |
| 292 |
if not endpoint.validateSipUri(self.cfgAccId.get()): |
| 293 |
errors += "Invalid SIP ID URI: '%s'\n" % (self.cfgAccId.get()) |
| 294 |
if self.cfgRegistrar.get(): |
| 295 |
if not endpoint.validateSipUri(self.cfgRegistrar.get()): |
| 296 |
errors += "Invalid SIP registrar URI: '%s'\n" % (self.cfgRegistrar.get()) |
| 297 |
if self.cfgProxy.get(): |
| 298 |
if not endpoint.validateSipUri(self.cfgProxy.get()): |
| 299 |
errors += "Invalid SIP proxy URI: '%s'\n" % (self.cfgProxy.get()) |
| 300 |
if self.cfgTurnEnabled.get(): |
| 301 |
if not self.cfgTurnServer.get(): |
| 302 |
errors += "TURN server is required\n" |
| 303 |
if errors: |
| 304 |
msgbox.showerror("Error detected:", errors) |
| 305 |
return |
| 306 |
|
| 307 |
|
| 308 |
self.cfg.priority = self.cfgPriority.get() |
| 309 |
self.cfg.idUri = self.cfgAccId.get() |
| 310 |
self.cfg.regConfig.registrarUri = self.cfgRegistrar.get() |
| 311 |
self.cfg.regConfig.registerOnAdd = self.cfgRegisterOnAdd.get() |
| 312 |
while len(self.cfg.sipConfig.authCreds): |
| 313 |
self.cfg.sipConfig.authCreds.pop() |
| 314 |
if self.cfgUsername.get(): |
| 315 |
cred = pj.AuthCredInfo() |
| 316 |
cred.scheme = "digest" |
| 317 |
cred.realm = "*" |
| 318 |
cred.username = self.cfgUsername.get() |
| 319 |
cred.data = self.cfgPassword.get() |
| 320 |
self.cfg.sipConfig.authCreds.append(cred) |
| 321 |
while len(self.cfg.sipConfig.proxies): |
| 322 |
self.cfg.sipConfig.proxies.pop() |
| 323 |
if self.cfgProxy.get(): |
| 324 |
self.cfg.sipConfig.proxies.append(self.cfgProxy.get()) |
| 325 |
|
| 326 |
|
| 327 |
self.cfg.callConfig.prackUse = self.cfgPrackUse.get() |
| 328 |
self.cfg.callConfig.timerUse = self.cfgTimerUse.get() |
| 329 |
self.cfg.callConfig.timerSessExpiresSec = self.cfgTimerExpires.get() |
| 330 |
self.cfg.presConfig.publishEnabled = self.cfgPublish.get() |
| 331 |
self.cfg.mwiConfig.enabled = self.cfgMwiEnabled.get() |
| 332 |
self.cfg.natConfig.contactRewriteUse = 1 if self.cfgEnableContactRewrite.get() else 0 |
| 333 |
self.cfg.natConfig.viaRewriteUse = 1 if self.cfgEnableViaRewrite.get() else 0 |
| 334 |
self.cfg.natConfig.sdpNatRewriteUse = 1 if self.cfgEnableSdpRewrite.get() else 0 |
| 335 |
self.cfg.natConfig.sipOutboundUse = 1 if self.cfgEnableSipOutbound.get() else 0 |
| 336 |
self.cfg.natConfig.udpKaIntervalSec = self.cfgKaInterval.get() |
| 337 |
|
| 338 |
|
| 339 |
self.cfg.mediaConfig.transportConfig.port = self.cfgMedPort.get() |
| 340 |
self.cfg.mediaConfig.transportConfig.portRange = self.cfgMedPortRange.get() |
| 341 |
self.cfg.mediaConfig.lockCodecEnabled = self.cfgMedLockCodec.get() |
| 342 |
self.cfg.mediaConfig.srtpUse = self.cfgMedSrtp.get() |
| 343 |
self.cfg.mediaConfig.srtpSecureSignaling = self.cfgMedSrtpSecure.get() |
| 344 |
self.cfg.mediaConfig.ipv6Use = pj.PJSUA_IPV6_ENABLED if self.cfgMedIpv6.get() else pj.PJSUA_IPV6_DISABLED |
| 345 |
|
| 346 |
|
| 347 |
self.cfg.natConfig.sipStunUse = self.cfgSipUseStun.get() |
| 348 |
self.cfg.natConfig.mediaStunUse = self.cfgMediaUseStun.get() |
| 349 |
self.cfg.natConfig.iceEnabled = self.cfgIceEnabled.get() |
| 350 |
self.cfg.natConfig.iceAggressiveNomination = self.cfgIceAggressive .get() |
| 351 |
self.cfg.natConfig.iceAlwaysUpdate = self.cfgAlwaysUpdate.get() |
| 352 |
self.cfg.natConfig.iceMaxHostCands = 0 if self.cfgIceNoHostCands.get() else -1 |
| 353 |
self.cfg.natConfig.turnEnabled = self.cfgTurnEnabled.get() |
| 354 |
self.cfg.natConfig.turnServer = self.cfgTurnServer.get() |
| 355 |
self.cfg.natConfig.turnConnType = self.cfgTurnConnType.get() |
| 356 |
self.cfg.natConfig.turnUserName = self.cfgTurnUser.get() |
| 357 |
self.cfg.natConfig.turnPasswordType = 0 |
| 358 |
self.cfg.natConfig.turnPassword = self.cfgTurnPasswd.get() |
| 359 |
|
| 360 |
self.isOk = True |
| 361 |
self.destroy() |
| 362 |
|
| 363 |
def onCancel(self): |
| 364 |
self.destroy() |
| 365 |
|
| 366 |
|
| 367 |
if __name__ == '__main__': |
| 368 |
application.main() |