def xfer_call_replaces(): if g_current_call == -1: write_log(3, "No current call") else: call = g_current_call ids = py_pjsua.enum_calls() if len(ids) <= 1: print "There are no other calls" return ci = py_pjsua.call_get_info(g_current_call) print "Transfer call [" + ` g_current_call ` + "] " + ci.remote_info + " to one of the following:" for i in range(0, len(ids)): if ids[i] == call: continue call_info = py_pjsua.call_get_info(ids[i]) print ` ids[ i] ` + " " + call_info.remote_info + " [" + call_info.state_text + "]" print "Enter call number to be replaced : " buf = sys.stdin.readline() buf = buf.replace("\n", "") if buf == "": return dst_call = int(buf) if call != g_current_call: print "Call has been disconnected" return if dst_call == call: print "Destination call number must not be the same as the call being transfered" return if dst_call >= py_pjsua.PJSUA_MAX_CALLS: print "Invalid destination call number" return if py_pjsua.call_is_active(dst_call) == 0: print "Invalid destination call number" return py_pjsua.call_xfer_replaces(call, dst_call, 0, None)
def xfer_call_replaces(): if g_current_call == -1: write_log(3, "No current call") else: call = g_current_call ids = py_pjsua.enum_calls() if len(ids) <= 1: print "There are no other calls" return ci = py_pjsua.call_get_info(g_current_call) print "Transfer call [" + `g_current_call` + "] " + ci.remote_info + " to one of the following:" for i in range(0, len(ids)): if ids[i] == call: continue call_info = py_pjsua.call_get_info(ids[i]) print `ids[i]` + " " + call_info.remote_info + " [" + call_info.state_text + "]" print "Enter call number to be replaced : " buf = sys.stdin.readline() buf = buf.replace("\n","") if buf == "": return dst_call = int(buf) if call != g_current_call: print "Call has been disconnected" return if dst_call == call: print "Destination call number must not be the same as the call being transfered" return if dst_call >= py_pjsua.PJSUA_MAX_CALLS: print "Invalid destination call number" return if py_pjsua.call_is_active(dst_call) == 0: print "Invalid destination call number" return py_pjsua.call_xfer_replaces(call, dst_call, 0, None)
py_pjsua.perror("py_pjsua", "codec set priority", status) c_param = py_pjsua.codec_get_param("coba") status = py_pjsua.codec_set_param("coba", c_param) print "py media codec set param " + ` status ` if status != 0: py_pjsua.perror("py_pjsua", "codec set param", status) #end of lib media #lib call count = py_pjsua.call_get_max_count() print "py call get max count " + ` count ` count = py_pjsua.call_get_count() print "py call get count " + ` count ` ids = py_pjsua.enum_calls() for id in ids: print "py enum calls id " + ` id ` msg_data = py_pjsua.Msg_Data() status, id = py_pjsua.call_make_call(-1, "sip:[email protected]", 0, 0, msg_data) print "py call make call " + ` status ` + " id " + ` id ` if status != 0: py_pjsua.perror("py_pjsua", "call make call", status) bool = py_pjsua.call_is_active(id) print "py call is active " + ` bool ` bool = py_pjsua.call_has_media(id) print "py call has media " + ` bool ` cp_id = py_pjsua.call_get_conf_port(id) print "py call get conf port " + ` cp_id ` info = py_pjsua.call_get_info(id)
py_pjsua.perror("py_pjsua","codec set priority",status) c_param = py_pjsua.codec_get_param("coba") status = py_pjsua.codec_set_param("coba", c_param) print "py media codec set param " + `status` if status != 0 : py_pjsua.perror("py_pjsua","codec set param",status) #end of lib media #lib call count = py_pjsua.call_get_max_count() print "py call get max count " + `count` count = py_pjsua.call_get_count() print "py call get count " + `count` ids = py_pjsua.enum_calls() for id in ids: print "py enum calls id " + `id` msg_data = py_pjsua.Msg_Data() status, id = py_pjsua.call_make_call(-1, "sip:[email protected]", 0, 0, msg_data) print "py call make call " + `status` + " id " + `id` if status != 0 : py_pjsua.perror("py_pjsua","call make call",status) bool = py_pjsua.call_is_active(id) print "py call is active " + `bool` bool = py_pjsua.call_has_media(id) print "py call has media " + `bool` cp_id = py_pjsua.call_get_conf_port(id) print "py call get conf port " + `cp_id` info = py_pjsua.call_get_info(id) if info != None :