コード例 #1
0
ファイル: pjsua_app.py プロジェクト: lhc180/Project-x
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)
コード例 #2
0
ファイル: pjsua_app.py プロジェクト: tibastral/symphonie
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)