当前位置: 首页>>代码示例>>Python>>正文


Python py_pjsua.perror函数代码示例

本文整理汇总了Python中py_pjsua.perror函数的典型用法代码示例。如果您正苦于以下问题:Python perror函数的具体用法?Python perror怎么用?Python perror使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了perror函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: xfer_call

def xfer_call():
	global g_current_call
	
	if g_current_call == -1:
		
		write_log(3, "No current call")

	else:
		call = g_current_call		
		ci = py_pjsua.call_get_info(g_current_call)
		print "Transfering current call ["+ `g_current_call` + "] " + ci.remote_info
		print "Enter sip url : "
		url = sys.stdin.readline()
		if url == "\n": 
			return
		url = url.replace("\n", "")
		if call != g_current_call:
			print "Call has been disconnected"
			return
		msg_data = py_pjsua.msg_data_init()
		status = py_pjsua.call_xfer(g_current_call, url, msg_data);
		if status != 0:
			py_pjsua.perror(THIS_FILE, "Error transfering call ", status)
		else:		
			write_log(3, "Call transfered to " + url)
开发者ID:tibastral,项目名称:symphonie,代码行数:25,代码来源:pjsua_app.py

示例2: worker_thread_main

def worker_thread_main(arg):
	global C_QUIT
	thread_desc = 0;
	status = py_pjsua.thread_register("python worker", thread_desc)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error registering thread", status)
	else:
		while C_QUIT == 0:
			py_pjsua.handle_events(50)
		print "Worker thread quitting.."
		C_QUIT = 2
开发者ID:tibastral,项目名称:symphonie,代码行数:11,代码来源:pjsua_app.py

示例3: add_account

def add_account():
	global g_acc_id

	acc_domain = ""
	acc_username = ""
	acc_passwd =""
	confirm = ""
	
	# Input account configs
	print "Your SIP domain (e.g. myprovider.com): ",
	acc_domain = sys.stdin.readline()
	if acc_domain == "\n": 
		return
	acc_domain = acc_domain.replace("\n", "")

	print "Your username (e.g. alice): ",
	acc_username = sys.stdin.readline()
	if acc_username == "\n":
		return
	acc_username = acc_username.replace("\n", "")

	print "Your password (e.g. secret): ",
	acc_passwd = sys.stdin.readline()
	if acc_passwd == "\n":
		return
	acc_passwd = acc_passwd.replace("\n", "")

	# Configure account configuration
	acc_cfg = py_pjsua.acc_config_default()
	acc_cfg.id = "sip:" + acc_username + "@" + acc_domain
	acc_cfg.reg_uri = "sip:" + acc_domain

	cred_info = py_pjsua.Pjsip_Cred_Info()
	cred_info.realm = "*"
	cred_info.scheme = "digest"
	cred_info.username = acc_username
	cred_info.data_type = 0
	cred_info.data = acc_passwd

	acc_cfg.cred_info.append(1)
	acc_cfg.cred_info[0] = cred_info

	# Add new SIP account
	status, acc_id = py_pjsua.acc_add(acc_cfg, 1)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error adding SIP account", status)
	else:
		g_acc_id = acc_id
		write_log(3, "Account " + acc_cfg.id + " added")
开发者ID:conght,项目名称:BLM-Lib,代码行数:49,代码来源:pjsua_app.py

示例4: disconnect_port

def disconnect_port():
	src_port = 0
	dst_port = 0
	
	print "Disconnect src port # (empty to cancel): "
	src_port = sys.stdin.readline()
	if src_port == "\n": 
		return
	src_port = src_port.replace("\n", "")
	src_port = int(src_port)
	print "From dst port # (empty to cancel): "
	dst_port = sys.stdin.readline()
	if dst_port == "\n": 
		return
	dst_port = dst_port.replace("\n", "")
	dst_port = int(dst_port)
	status = py_pjsua.conf_disconnect(src_port, dst_port)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error disconnecting port ", status)
	else:		
		write_log(3, "Port disconnected " + `src_port` + " from " + `dst_port`)
开发者ID:tibastral,项目名称:symphonie,代码行数:21,代码来源:pjsua_app.py

示例5: add_recorder

def add_recorder():
	global g_rec_file
	global g_rec_id
	global g_rec_port
	
	file_name = ""
	status = -1
	rec_id = 0
	
	print "Enter the path of the file recorder(e.g. /tmp/audio.wav): ",
	file_name = sys.stdin.readline()
	if file_name == "\n": 
		return
	file_name = file_name.replace("\n", "")
	status, rec_id = py_pjsua.recorder_create(file_name, 0, None, 0, 0)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error adding file recorder ", status)
	else:
		g_rec_file = file_name
		g_rec_id = rec_id
		g_rec_port = py_pjsua.recorder_get_conf_port(rec_id)
		write_log(3, "File recorder " + file_name + " added")
开发者ID:tibastral,项目名称:symphonie,代码行数:22,代码来源:pjsua_app.py

示例6: add_player

def add_player():
	global g_wav_files
	global g_wav_id
	global g_wav_port
	
	file_name = ""
	status = -1
	wav_id = 0
	
	print "Enter the path of the file player(e.g. /tmp/audio.wav): ",
	file_name = sys.stdin.readline()
	if file_name == "\n": 
		return
	file_name = file_name.replace("\n", "")
	status, wav_id = py_pjsua.player_create(file_name, 0)
	if status != 0:
		py_pjsua.perror(THIS_FILE, "Error adding file player ", status)
	else:
		g_wav_files.append(file_name)
		if g_wav_id == 0:
			g_wav_id = wav_id
			g_wav_port = py_pjsua.player_get_conf_port(wav_id)
		write_log(3, "File player " + file_name + " added")
开发者ID:tibastral,项目名称:symphonie,代码行数:23,代码来源:pjsua_app.py

示例7: app_menu

def app_menu():
	global g_acc_id
	global g_current_call

	quit = 0
	while quit == 0:
		print_menu()
		choice = sys.stdin.readline()

		if choice[0] == "q":
			quit = 1

		elif choice[0] == "i":
			# Sending IM	
			print "Send IM to SIP URL: ",
			url = sys.stdin.readline()
			if url == "\n":
				continue

			# Send typing indication
			py_pjsua.im_typing(g_acc_id, url, 1, None) 

			print "The content: ",
			message = sys.stdin.readline()
			if message == "\n":
				py_pjsua.im_typing(g_acc_id, url, 0, None) 		
				continue

			# Send the IM!
			py_pjsua.im_send(g_acc_id, url, None, message, None, 0)

		elif choice[0] == "m":
			# Make call 
			print "Using account ", g_acc_id
			print "Make call to SIP URL: ",
			url = sys.stdin.readline()
			url = url.replace("\n", "")
			if url == "":
				continue

			# Initiate the call!
			status, call_id = py_pjsua.call_make_call(g_acc_id, url, 0, 0, None)
            
			if status != 0:
				py_pjsua.perror(THIS_FILE, "Error making call", status)
			else:
				g_current_call = call_id

		elif choice[0] == "+" and choice[1] == "b":
			# Add new buddy
			bc = py_pjsua.Buddy_Config()
			print "Buddy URL: ",
			bc.uri = sys.stdin.readline()
			if bc.uri == "\n":
				continue
            
			bc.uri = bc.uri.replace("\n", "")
			bc.subscribe = 1
			status, buddy_id = py_pjsua.buddy_add(bc)
			if status != 0:
				py_pjsua.perror(THIS_FILE, "Error adding buddy", status)
		elif choice[0] == "-" and choice[1] == "b":
			print "Enter buddy ID to delete : "
			buf = sys.stdin.readline()
			buf = buf.replace("\n","")
			if buf == "":
				continue
			i = int(buf)
			if py_pjsua.buddy_is_valid(i) == 0:
				print "Invalid buddy id " + `i`
			else:
				py_pjsua.buddy_del(i)
				print "Buddy " + `i` + " deleted"		
		elif choice[0] == "+" and choice[1] == "a":
			# Add account
			add_account()
		elif choice[0] == "-" and choice[1] == "a":
			print "Enter account ID to delete : "
			buf = sys.stdin.readline()
			buf = buf.replace("\n","")
			if buf == "":
				continue
			i = int(buf)

			if py_pjsua.acc_is_valid(i) == 0:
				print "Invalid account id " + `i`
			else:
				py_pjsua.acc_del(i)
				print "Account " + `i` + " deleted"
	    
		elif choice[0] == "+" and choice[1] == "p":
			add_player()
		elif choice[0] == "+" and choice[1] == "r":
			add_recorder()
		elif choice[0] == "c" and choice[1] == "l":
			conf_list()
		elif choice[0] == "c" and choice[1] == "c":
			connect_port()
		elif choice[0] == "c" and choice[1] == "d":
			disconnect_port()
#.........这里部分代码省略.........
开发者ID:tibastral,项目名称:symphonie,代码行数:101,代码来源:pjsua_app.py

示例8: err_exit

def err_exit(title, rc):
    py_pjsua.perror(THIS_FILE, title, rc)
    exit(1)
开发者ID:tibastral,项目名称:symphonie,代码行数:3,代码来源:pjsua_app.py

示例9: err_exit

def err_exit(title, rc):
    py_pjsua.perror(THIS_FILE, title, rc)
    py_pjsua.destroy()
    exit(1)
开发者ID:conght,项目名称:BLM-Lib,代码行数:4,代码来源:pjsua_app.py

示例10:


py_pjsua.normalize_stun_config(stunc);


status, id = py_pjsua.transport_create(1, tc);
print "py transport create status " + `status`

ti = py_pjsua.Transport_Info();
ti = py_pjsua.transport_get_info(id)
print "py transport get info status " + `status`

status = py_pjsua.transport_set_enable(id,1)
print "py transport set enable status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","set enable",status)


status = py_pjsua.transport_close(id,1)
print "py transport close status " + `status`
if status != 0 :
	py_pjsua.perror("py_pjsua","close",status)

# end of lib transport

# lib account 

accfg = py_pjsua.acc_config_default()
status, accid = py_pjsua.acc_add(accfg, 1)
print "py acc add status " + `status`
if status != 0 :
开发者ID:avble,项目名称:natClientEx,代码行数:29,代码来源:pjsua.py


注:本文中的py_pjsua.perror函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。