Example #1
0
# Logging callback.
#
def logging_cb1(level, str, len):
    print str,


#
# Configure logging
#
log_cfg.cb = logging_cb1
log_cfg.console_level = 4

#
# Initialize pjsua!
#
status = py_pjsua.init(ua_cfg, log_cfg, media_cfg)
print "py status after initialization :" + ` status `

#
# Start pjsua!
#
status = py_pjsua.start()
if status != 0:
    exit(1)

message = py_pjsua.msg_data_init()

print "identitas object message data :" + ` message `

sipaddr = 'sip:167.205.34.99'
print "checking sip address [%s] : %d" % (sipaddr,
Example #2
0
def app_init():
	global g_acc_id, g_ua_cfg

	# Create pjsua before anything else
	status = py_pjsua.create()
	if status != 0:
		err_exit("pjsua create() error", status)

	# Create and initialize logging config
	log_cfg = py_pjsua.logging_config_default()
	log_cfg.level = C_LOG_LEVEL
	log_cfg.cb = log_cb

	# Create and initialize pjsua config
	# Note: for this Python module, thread_cnt must be 0 since Python
	#       doesn't like to be called from alien thread (pjsua's thread
	#       in this case)	    
	ua_cfg = py_pjsua.config_default()
	ua_cfg.thread_cnt = 0
	ua_cfg.user_agent = "PJSUA/Python 0.1"
	ua_cfg.cb.on_incoming_call = on_incoming_call
	ua_cfg.cb.on_call_media_state = on_call_media_state
	ua_cfg.cb.on_reg_state = on_reg_state
	ua_cfg.cb.on_call_state = on_call_state
	ua_cfg.cb.on_buddy_state = on_buddy_state
	ua_cfg.cb.on_pager = on_pager
	ua_cfg.cb.on_pager_status = on_pager_status
	ua_cfg.cb.on_typing = on_typing
	ua_cfg.cb.on_call_transfer_status = on_call_transfer_status
	ua_cfg.cb.on_call_transfer_request = on_call_transfer_request

	# Create and initialize media config
	med_cfg = py_pjsua.media_config_default()
	med_cfg.ec_tail_len = 0

	#
	# Initialize pjsua!!
	#
	status = py_pjsua.init(ua_cfg, log_cfg, med_cfg)
	if status != 0:
		err_exit("pjsua init() error", status)

	# Configure STUN config
	stun_cfg = py_pjsua.stun_config_default()
	stun_cfg.stun_srv1 = C_STUN_SRV
	stun_cfg.stun_srv2 = C_STUN_SRV
	stun_cfg.stun_port1 = C_STUN_PORT
	stun_cfg.stun_port2 = C_STUN_PORT

	# Configure UDP transport config
	transport_cfg = py_pjsua.transport_config_default()
	transport_cfg.port = C_SIP_PORT
	transport_cfg.stun_config = stun_cfg
	if C_STUN_SRV != "":
		transport_cfg.use_stun = 1

	# Create UDP transport
	status, transport_id = \
	    py_pjsua.transport_create(py_pjsua.PJSIP_TRANSPORT_UDP, transport_cfg)
	if status != 0:
		py_pjsua.destroy()
		err_exit("Error creating UDP transport", status)

	# Create initial default account
	status, acc_id = py_pjsua.acc_add_local(transport_id, 1)
	if status != 0:
		py_pjsua.destroy()
		err_exit("Error creating account", status)

	g_acc_id = acc_id
	g_ua_cfg = ua_cfg
Example #3
0
# Logging callback.
#
def logging_cb1(level, str, len):
    print str,


#
# Configure logging
#
log_cfg.cb = logging_cb1
log_cfg.console_level = 4

#
# Initialize pjsua!
#
status = py_pjsua.init(ua_cfg, log_cfg, media_cfg);
print "py status after initialization :" + `status`


#
# Start pjsua!
#
status = py_pjsua.start()
if status != 0:
    exit(1)


message = py_pjsua.msg_data_init()

print "identitas object message data :" + `message`