import socket
import os
import config
import status
import runtime
from setting import setting
import profile
from roxiadebug import *
import utils
from mmiDebug import *
from runtime import mmiDebug as MD
import errorcode
from mmiSoundPath import SP_Context, SP_State
from dectHandler import DectCallManager
from dectConfig import MessageCode
class VDCIApp:
ch1 = 0
ch2 = 0
is_playing_tone = False
tone = config.PLAY_DIAL_TONE
pid_player = None
RINGING = '1'
BUSY = '2'
WAITING = '3'
UNKNOWN = '4'
def __init__(self):
self.caller = False
self.with_error = False
self.hangup_timer = None
self.modem_speed = 0
self.vdciapp_pid = None
self.clntSock = None
self.run_recv_thread = None
self.need_update = False
self.exiting = False
# eicho add 06.11.28
self.no_response_timer = None
# KA: [20080420] new register
self.subscriber_timer = None
self.retry_subscriber_count = 0
self.subscriber_success = False
self.subscriber_expire = None
self.vm_register = False
status.set_register_mode(status.NotRegistered)
status.set_regstatus(0)
# KA: [20080420] new register ==
#os.system("fb0top 1")
self.mmcidList = []
status.dnsPingCount = False
self.vmIncomingData = None
self.rtpTxTimer = None
def remove_ss_sw_timer(self):
status.Off_flag_incoming_ss()
if self.no_response_timer:
#status.flag_state_first_incoming_ss = False
if config.update_debug:
print '### remove ss_sw_flag_timer~~~'
del(self.no_response_timer)
self.no_response_timer = None
def run_vdciapp(self):
status.FirstRegistered_check_flag_for_QoS_setting = False
roxia_event('VDCIApp.run_vdciapp()')
try:
os.unlink(config.vdci_socket_path)
except OSError:
pass
import time
time.sleep(2)
self.vdciapp_pid = os.fork()
if self.vdciapp_pid == 0:
try:
os.execlp('VDCIApp','VDCIApp')
except:
os._exit(1)
self.clntSock = socket.socket( socket.AF_UNIX, socket.SOCK_STREAM )
self.clntSock.setblocking( 1 )
try_connect = 0
while try_connect < 10:
try_connect += 1
connected = True
try:
self.clntSock.connect( config.vdci_socket_path )
except:
connected = False
if connected:
roxia_trace('** VDCIApp socket connected! **')
break
else: # sock connect error, retry..
roxia_trace('** VDCIApp socket connect failed, retry', try_connect, '**')
time.sleep(1)
import evas
self.run_recv_thread=runtime.evas.input_add(self.clntSock.fileno(),\
evas.INPUT_READ, self.recv_mesg_thread_ex)
return False
def set_screen_clip(self,off=False):
g_set_screen_clip(off)
def get_statistics(self):
self.send_mesg(code1=config.MESG_GET_STATISTICS)
# KA: [20071126] DTMF nego
def send_dtmf(self, dtmf):
dtmf_play = 1
if setting.dtmf_set == '0': #nego
if status.get_current_dtmf_type() == status.RFC2833:
self.send_mesg(code1=config.MESG_SEND_DTMF, code2=config.MESG_SEND_DTMF, mesg1=dtmf, mesg3=dtmf_play)
elif status.get_current_dtmf_type() == status.INFO_DTMF:
self.send_info_dtmf(dtmf)
elif status.get_current_dtmf_type() == status.INBAND:
self.send_inband_dtmf(dtmf)
else:
self.send_mesg(code1=config.MESG_SEND_DTMF, code2=config.MESG_SEND_DTMF, mesg1=dtmf, mesg3=dtmf_play)
else: #info
self.send_info_dtmf(dtmf)
def send_inband_dtmf(self, dtmf):
dtmf_play = 1
if dtmf =='C' or dtmf == 'A':
dtmf_play = 0 # Do not play
self.send_mesg(code1=config.MESG_SEND_DTMF,code2=config.MESG_INBAND_DTMF, mesg1=dtmf, mesg3=dtmf_play)
#self.send_mesg(code1=config.MESG_SEND_DTMF,code2=config.MESG_INBAND_DTMF, mesg1=dtmf, mesg2=config.dtmf_duration,mesg3=dtmf_play)
def send_info_dtmf(self, dtmf):
dtmf_play = 1
if dtmf =='C' or dtmf == 'A':
dtmf_play = 0 # Do not play
self.send_mesg(code1=config.MESG_SEND_DTMF,code2=config.MESG_INFO_DTMF, mesg1=dtmf, mesg3=dtmf_play, mesg4=3)
#self.send_mesg(code1=config.MESG_SEND_DTMF, code2=config.MESG_INFO_DTMF, mesg1=dtmf, mesg2=config.dtmf_duration, mesg3=dtmf_play)
# KA: [20071126] DTMF nego ==
def send_hook_flash(self):
self.send_mesg(code1=config.MESG_SEND_DTMF, code2=config.MESG_HOOK_FLASH, mesg1=2)
def req_deregister(self):
#if status.telnum and status.get_register_mode() == status.Registered:
self.send_mesg(code1=config.MESG_REGISTERATION, \
code2=config.MESG_UNREGISTER, \
mesg1=status.telnum)
# KA: [20071105] TI IMS subscriber
def req_desubscriber(self):
self.send_mesg(code1=config.MESG_DE_SUBSCRIBER, \
code2=config.MESG_DE_SUBSCRIBER_REQUEST,\
mesg1='17', \
mesg3=status.telnum)
def req_subscriber(self):
from vdcisetting import vdci_setting
if self.subscriber_expire:
expires = self.subscriber_expire
else:
#for test
try:
if vdci_setting.verify_mode == '1':
expires = '360'
else:
expires = vdci_setting.subscriber_expires
except:
expires = vdci_setting.subscriber_expires
self.send_mesg(code1=config.MESG_SUBSCRIBER, \
code2=config.MESG_SUBSCIRBER_REQUEST,\
mesg1='17', \
mesg3=status.telnum,\
mesg4=expires)
# KA: [20071105] TI IMS subscriber ==
# KA: [20080420] new reigster
def do_subscriber(self):
self.req_subscriber()
return False
def retry_subscriber(self):
roxia_trace('** retry_subscriber**')
if self.retry_subscriber_count > 2:
#self.retry_subscriber_count = 0
self.subscriber_timer = None
else:
self.retry_subscriber_count += 1
self.subscriber_timer = utils.Timer(4000, self.do_subscriber)
# KA: [20080420] new reigster ==
# send message to server
def send_mesg(self, code1, code2 = None, chan1 = 0, chan2 = 0, \
mesg1 = None, mesg2 = None, mesg3 = None, mesg4 = None, mesg5 = None, \
mesg6 = None, mesg7 = None, mesg8 = None, mesg9 = None, mesg10= None):
def make_code(code1, code2):
if code2 == None:
return code1 + '|' + code1
else:
return code1 + '|' + code2
def get_str_mesg(mesg):
if mesg == None:
return ''
elif type(mesg).__name__ == 'int':
return '%d' % mesg
else:
return '%s' % mesg
# channel assignment
# channel 1
if code1 == config.MESG_OUTGOING_CALL:
status.assign_outgoing_channel()
if status.active_call_index == 0:
chan1 = int(status.first_active_ch)
else:
chan1 = int(status.second_active_ch)
elif code1 == config.MESG_HANGUP:
if status.active_call_index == 0:
chan1 = int(status.first_active_ch)
else:
chan1 = int(status.second_active_ch)
elif code1 == config.MESG_INCOMING_CALL:
if code2 == config.MESG_CALL_ACCEPT:
#ka...2007.05.25 channel할당은 위에서 할당받은 값 그대로
if mesg3 != config.MESG_INDIRECT_VIDEO_REJECT or not chan1:
if status.active_call_index == 0:
chan1 = int(status.first_active_ch)
else:
chan1 = int(status.second_active_ch)
#else:
# if not chan1:
# if status.active_call_index == 0:
# chan1 = int(status.first_active_ch)
# else:
# chan1 = int(status.second_active_ch)
if code2 == config.MESG_CALL_REJECT:
if chan1 == 0: # not assigned manually 05.09.14
if status.active_call_index == 0:
chan1 = int(status.first_active_ch)
else:
chan1 = int(status.second_active_ch)
else:
pass
else: # others for code1
if chan1 == 0: # not assigned manually 05.09.14
if status.active_call_index == 0:
chan1 = int(status.first_active_ch)
else:
chan1 = int(status.second_active_ch)
else:
pass
# channel 2
if code1 == config.MESG_CALL_TRANSFER:
if code2 == config.MESG_CALL_TRANSFER_BLIND:
chan2 = int(0)
else:
if status.active_call_index == 0:
chan2 = int(status.second_active_ch)
else:
chan2 = int(status.first_active_ch)
else:
chan2 = int(0)
if profile.ip_mode == 1:
if code1 == config.MESG_OUTGOING_CALL or \
code1 == config.MESG_REGISTERATION or \
code1 == config.MESG_STARTUP:
self.exiting = False
if code1 == config.MESG_HANGUP:
# eicho add 06.11.27
#status.Off_flag_incoming_ss()
self.remove_ss_sw_timer()
# end
self.with_error = False
import utils
if profile.ip_mode == 1:
if runtime.manager.stage.get_name() == 'VideoCallConnecting' or \
runtime.manager.stage.get_name() == 'VideoCallConnected' or \
runtime.manager.stage.get_name() == 'AudioCallConnected':
if config.videocall_debug: print '08.21 MESG_HANGUP 1'
self.end_call()
else: # PSTN
#self.hangup_timer = utils.Timer(3000, self.end_call)
#print 'eicho)))) vdciapp.end_call()!!!!!!!!1'
if config.videocall_debug: print '08.21 MESG_HANGUP 2'
self.end_call()
#runtime.eaHandler.endCall()
'''
if status.KT_CALL_TESTER:
print 'send_mesg'
status.KT_CALL_TESTER.restartTestCall()
'''
_code = make_code(code1, code2)
_mesg1 = get_str_mesg(mesg1)
_mesg2 = get_str_mesg(mesg2)
_mesg3 = get_str_mesg(mesg3)
_mesg4 = get_str_mesg(mesg4)
_mesg5 = get_str_mesg(mesg5)
_mesg6 = get_str_mesg(mesg6)
_mesg7 = get_str_mesg(mesg7)
_mesg8 = get_str_mesg(mesg8)
_mesg9 = get_str_mesg(mesg9)
_mesg10 = get_str_mesg(mesg10)
message = ''
message = '%s|%d|%d|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|' % (_code, chan1, chan2, _mesg1, _mesg2, _mesg3, _mesg4, _mesg5, _mesg6, _mesg7, _mesg8, _mesg9, _mesg10)
message = '%d|%s' % (len(message), message)
if config.videocall_debug:
print '#### send:', message
debugLogN("*send:", message)
if self.clntSock != None:
try:
self.clntSock.send(message)
except:
print 'EXCEPTION'
if profile.ip_mode == 1:
if runtime.manager.stage.get_name() == 'registering':
runtime.manager.stage.register_error()
return
self.with_error = True
if status.phone_status != status.Disconnected:
if config.videocall_debug: print '08.21 MESG_HANGUP 3 it is not DISCONNECTED'
self.end_call()
def changeDimension(self):
if status.videocall_dimension_mobile:
# 2가지 모드로 전환
# 13 / 14
if status.videocall_dimension != config.DIMENSION_REMOTE_SMALL_CENTER_LOCAL_SMALL:
status.videocall_dimension = config.DIMENSION_REMOTE_SMALL_CENTER_LOCAL_SMALL
else:
status.videocall_dimension = config.DIMENSION_LOCAL_SMALL_CENTER_REMOTE_SMALL
else:
# 2가지 모드로 전환
# 11 /12
if status.videocall_dimension != config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_WQVGA:
status.videocall_dimension = config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_WQVGA
else:
status.videocall_dimension = config.DIMENSION_LOCAL_BIG_REMOTE_SMALL_WQVGA
runtime.vdciapp.send_mesg(code1=config.MESG_SET_PARAMS, \
code2=config.MESG_SET_DIMENSION, \
mesg1=status.videocall_dimension, \
mesg2=config.DIMENSION_TEMPORARY_SET)
# newly defined. TUP and VDCIApp have changed as well.
def change_dimension(self,mode=None,clip_off=False):
if mode != None:
if status.videocall_dimension == mode:
return
else:
status.videocall_dimension = mode
else:
#status.videocall_dimension = (status.videocall_dimension + 1) % config.DIMENSION_RESIZE_ROTATE
status.videocall_dimension = (status.videocall_dimension + 1)
if status.videocall_dimension > config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_BOTTOM:
status.videocall_dimension = config.DIMENSION_REMOTE_BIG_ONLY_WQVGA
runtime.vdciapp.send_mesg(code1=config.MESG_SET_PARAMS, \
code2=config.MESG_SET_DIMENSION, \
mesg1=status.videocall_dimension, \
mesg2=config.DIMENSION_TEMPORARY_SET)
self.set_screen_clip(clip_off)
# if status.videocall_dimension == config.DIMENSION_REMOTE_BIG_LOCAL_SMALL or \
# status.videocall_dimension == config.DIMENSION_REMOTE_BIG_ONLY:
utils.show_softkey(False)
# else:
# utils.show_softkey()
def get_connection_info(self):
self.send_mesg(code1=config.MESG_GET_PARAMS, \
code2=config.MESG_GET_INFO, \
mesg1=config.INFO_FPS)
def end_call_by_inactive_remote(self):
# switch to inactive line to end call
status.toggle_active_call()
status.set_current_call_status()
#ka...slim 2007.05.27 069 call중에 SecondIncomingCall/ 069종료
status.dialed_TdESupplementary = False
if runtime.manager.stage.get_name() == 'SecondIncomingCall':
runtime.manager.stage.incoming_disconnected()
elif runtime.manager.stage.get_name() == 'SecondCallConnecting':
if status.business_option_status == status.BlindTransferOption:
pass
else:
runtime.manager.handle_second_call_log()
status.release_channel()
status.reset_call_status()
status.toggle_active_call()
status.set_current_call_status()
status.business_option_status = status.NotSelected
status.business_call_status = status.OneCallConnected
status.waiting = 0
import model
runtime.manager.change_stage(model.AudioCallConnectingStage(status.dial_number), True)
elif runtime.manager.stage.get_name() == 'TwoCallOneHold':
import options
runtime.manager.stack_stage(options.BackToConnectedStage(status.display_caller_name(status.active_call_index)+'\n'+_('disconnected.')))
elif runtime.manager.stage.get_name() == 'SecondCallEnblockEdit' or \
runtime.manager.stage.get_name() == 'DialSecondCall':
status.set_current_call_status()
runtime.manager.stop_audio_call(False)
elif runtime.manager.stage.get_name() == 'CallConference':
import options
print '*** end_call_by_inactive_remote 2'
runtime.manager.stack_stage(options.BackToConnectedStage(status.display_caller_name(status.active_call_index)+'\n'+_('disconnected.')))
def end_call_by_active_remote(self):
print '*** end_call_by_active_remote'
if runtime.manager.stage.get_name() == 'SecondIncomingCall':
runtime.manager.stage.connected_disconnected()
elif runtime.manager.stage.get_name() == 'SecondCallConnecting':
import time
time.sleep(2)
#runtime.vdci_stop_tone()
runtime.SP_context.stopTonePlay()
import options
runtime.manager.stack_stage(options.ReleaseHoldBackToConnectedStage(status.display_caller_name(status.active_call_index)+'\n'+_('disconnected.')))
elif runtime.manager.stage.get_name() == 'TwoCallOneHold':
status.clear_audio_mute()
import options
runtime.manager.stack_stage(options.ReleaseHoldBackToConnectedStage(status.display_caller_name(status.active_call_index)+'\n'+_('disconnected.')))
elif runtime.manager.stage.get_name() == 'SecondCallEnblockEdit' or \
runtime.manager.stage.get_name() == 'DialSecondCall':
status.set_current_call_status()
runtime.manager.stop_audio_call(False)
elif runtime.manager.stage.get_name() == 'CallConference':
status.toggle_all_hold_and_held_flag()
import options
print '*** end_call_by_active_remote 2'
runtime.manager.stack_stage(options.BackToConnectedStage(status.display_caller_name(status.active_call_index)+'\n'+_('disconnected.')))
def end_call(self, with_error=False):
MD.mmiTrace('vdciapp.end_call(), current stage=', runtime.manager.stage.get_name())
import status
status.call_type = 0 # default: audio
if self.exiting:
return
if runtime.manager.stage.get_name() == 'VideoCallConnecting' or \
runtime.manager.stage.get_name() == 'VideoCallConnected' or \
runtime.manager.stage.get_name() == 'AudioCallConnected' or \
runtime.manager.stage.get_name() == 'HMConnected':
runtime.manager.stage.stopCallDuration()
# set trap info
MD.mmiTrace('status.currentCallDuration_copy = ', status.currentCallDuration_copy)
if status.currentCallDuration_copy == (0, 0, 0):
setting.voipOrgCallTime = 0
setting.voipTermCallTime = 0
else:
baseCallStatus = runtime.SP_context.getBaseCallStatus()
if baseCallStatus in [SP_Context.INCOMING_AUDIO, SP_Context.INCOMING_VIDEO]:
setting.voipOrgCallTime = setting.voipOrgCallTime + status.currentCallDuration_copy[0]*60*60 + status.currentCallDuration_copy[1]*60 + status.currentCallDuration_copy[2]
elif baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO]:
setting.voipTermCallTime = setting.voipTermCallTime + status.currentCallDuration_copy[0]*60*60 + status.currentCallDuration_copy[1]*60 + status.currentCallDuration_copy[2]
else:
runtime.mmiDebug.mmiException('ERROR in CallTime TRAP')
runtime.mmiDebug.mmiTrace('VDCIApp:end_call:setting.voipOrgCallTime = ', setting.voipTermCallTime, ' :: setting.voipOrgCallTime = ', setting.voipTermCallTime)
self.exiting = True
self.hangup_timer = None
self.remove_ss_sw_timer()
if runtime.manager.stage.get_name() == 'VideoCallTerminated':
return False
# eicho add 06.08.22 when MSG_HANGUP is from CallConnectingStage, skip over stop_video_call.
elif runtime.manager.stage.get_name() == 'callconnecting':
return False
# end.
elif status.videocall_mode == status.VideoCallConnecting and \
runtime.manager.stage.get_name() != 'VideoCallConnecting':
runtime.manager.back_stage('VideoCallConnecting')
elif status.videocall_mode == status.VideoCallConnected and \
runtime.manager.stage.get_name() != 'VideoCallConnected' and \
runtime.manager.stage.get_name() != 'AudioCallConnected' and \
runtime.manager.stage.get_name() != 'HMConnected':
if status.video_mode==status.AudioConnected:
if status.business_call_status == status.TwoCallOneHold:
runtime.manager.back_stage('TwoCallOneHold')
elif status.business_call_status == status.TwoCallOneDialing:
runtime.manager.back_stage('SecondCallEnblockEdit')
elif status.business_call_status == status.TwoCallConnected:
runtime.manager.back_stage('CallConference')
else:
runtime.manager.back_stage('AudioCallConnected')
else:
runtime.manager.back_stage('VideoCallConnected')
# for protect
# 현재는 잘못된 시나리오이다. 추후 수정해야 한다.
if runtime.manager.stage.get_name() == 'VideoCallConnecting' or \
runtime.manager.stage.get_name() == 'VideoCallConnected' or \
runtime.manager.stage.get_name() == 'AudioCallConnected' or \
runtime.manager.stage.get_name() == 'HMConnected':
runtime.manager.stage.end_call(with_error)
elif runtime.manager.stage.get_name() == 'incomingcall':
# idle로 가지 않아 여기서 베이스 상태를 dect에 보냄
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if runtime.dectCallManager.isSubcribedDect() and dectStatus != DectCallManager.IDLE:
runtime.dectCallManager.rejectCallByBase()
runtime.manager.kill_ringer()
runtime.manager.handle_missing_call()
runtime.dectCallManager.sendVideophoneStatusReportToDect(MessageCode.VP_STATUS.IDLE)
else: # phone in something wrong state
if status.video_mode==status.AudioConnected:
if status.business_call_status == status.TwoCallOneHold:
runtime.vdciapp.end_call_by_active_remote()
elif status.business_call_status == status.TwoCallOneDialing:
runtime.vdciapp.end_call_by_active_remote()
elif status.business_call_status == status.TwoCallConnected:
runtime.vdciapp.end_call_by_active_remote()
else:
runtime.manager.stop_audio_call(self.with_error)
elif status.video_mode != status.VideoIdle:
print '### Really THIS POINT ???'
#runtime.manager.stop_video_call(self.with_error)
else:
pass
return False
# old: msglen | code | mesg |
# new: msglen | code1 | code2 | chan1 | chan2 | mesg1 | mesg2 | mesg3 | mesg4 | mesg5 | mesg6 | mesg7 | mesg8 |
def recv_mesg_thread_ex(self,clntSock,type):
debugLogN("recv_mesg_thread_ex")
import status
try:
mesg = self.clntSock.recv( 1024 )
except:
self.with_error = True
if config.videocall_debug: print '08.21 MESG_HANGUP 5- recv_mesg_thread_ex'
self.end_call()
return
#ex) mesg='11|o|s|0|0|||||||||'
if len( mesg ) == 0: # Disconnected from unix socket
if self.run_recv_thread != None:
runtime.evas.input_remove(self.run_recv_thread)
self.run_recv_thread = None
self.with_error = True
if profile.ip_mode == 1:
if runtime.manager.stage.get_name() == 'registering':
status.set_register_mode(status.RegisterError)
runtime.manager.stage.register_error()
return
if status.video_mode != status.VideoIdle or \
(status.first_video_mode != status.VideoIdle and status.second_video_mode != status.VideoIdle):
if config.videocall_debug: print '08.21 MESG_HANGUP 6'
runtime.evas.idle_add(self.end_call)
debugLogN("*recv:", mesg)
if config.videocall_debug:
print '#### recv:', mesg
while mesg: # parse message
#ex) mesg_len=mesg[:2]
#ex) mesg_len='11'
mesg_len = mesg[:mesg.index('|')] # get size of mesg as string
#ex) size_len=len('11'), size_len=2
size_len = len( mesg_len ) # get length of mesg size part
#ex) mesg_len=11
mesg_len = int( mesg_len ) # convert mesg size from string to int
#ex) mesg[3:14], mesg_content='o|s|0|0||||'
mesg_content = mesg[mesg.index('|')+1:mesg_len+size_len+1]
#ex) mesg=mesg[15:], mesg=next packet
mesg = mesg[mesg_len+size_len+1:]
# proc return packet / server event packet
if mesg_content[0] == config.MESG_NOERROR or mesg_content[0] == config.MESG_ERROR:
self.proc_return_mesg_ex( mesg_content )
elif mesg_content[0] == config.MESG_SERVER_NOERROR or \
mesg_content[0] == config.MESG_SERVER_ERROR:
self.proc_server_mesg_ex( mesg_content )
return True
def proc_return_mesg_ex(self,mesg):
debugLogN("proc_return_mesg_ex")
# shchun : add safety code
_mesg1 = _mesg2 = _mesg3 = _mesg4 = _mesg5 = _mesg6 = _mesg7 = _mesg8 = _mesg9 = _mesg10 = None
_mesg11= _mesg12= _mesg13= _mesg14= _mesg15= _mesg16= _mesg17= _mesg18= _mesg19= None
# end shchun
mlist = mesg.split('|')
_result = mlist[0]
_requested = mlist[1]
_chan1 = mlist[2]
_chan2 = mlist[3]
_mesg1 = mlist[4]
_mesg2 = mlist[5]
if len(mlist) > 6: _mesg3 = mlist[6]
if len(mlist) > 7: _mesg4 = mlist[7]
if len(mlist) > 8: _mesg5 = mlist[8]
if len(mlist) > 9: _mesg6 = mlist[9]
if len(mlist) > 10: _mesg7 = mlist[10]
if len(mlist) > 11: _mesg8 = mlist[11]
if len(mlist) > 12: _mesg9 = mlist[12]
if len(mlist) > 13: _mesg10 = mlist[13]
if len(mlist) > 14: _mesg11 = mlist[14]
if len(mlist) > 15: _mesg12 = mlist[15]
if len(mlist) > 16: _mesg13 = mlist[16]
# KA: [20071116] TI IMS TEST
if len(mlist) > 17: _mesg14 = mlist[17]
if len(mlist) > 18: _mesg15 = mlist[18]
if len(mlist) > 19: _mesg16 = mlist[19]
if len(mlist) > 20: _mesg17 = mlist[20]
if len(mlist) > 21: _mesg18 = mlist[21]
if len(mlist) > 22: _mesg19 = mlist[22]
if config.videocall_debug:
print 'RETURN MSG :',_result,_requested,_chan1,_chan2,_mesg1,_mesg2
if len(mlist) > 6: print '_mesg3=', _mesg3
if len(mlist) > 7: print '_mesg4=', _mesg4
if len(mlist) > 8: print '_mesg5=', _mesg5
if len(mlist) > 9: print '_mesg6=', _mesg6
if len(mlist) > 10: print '_mesg7=', _mesg7
if len(mlist) > 11: print '_mesg8=', _mesg8
if len(mlist) > 12: print '_mesg9=', _mesg9
if len(mlist) > 13: print '_mesg10=', _mesg10
if len(mlist) > 14: print '_mesg11=', _mesg11
if len(mlist) > 15: print '_mesg12=', _mesg12
if len(mlist) > 16: print '_mesg13=', _mesg13
# KA: [20071116] TI IMS TEST
if len(mlist) > 17: print '_mesg14=', _mesg14
if len(mlist) > 18: print '_mesg15=', _mesg15
if len(mlist) > 19: print '_mesg14=', _mesg16
if len(mlist) > 20: print '_mesg15=', _mesg17
if len(mlist) > 21: print '_mesg14=', _mesg18
if len(mlist) > 22: print '_mesg15=', _mesg19
if _result == config.MESG_NOERROR:
if _requested == config.MESG_STARTUP:
if runtime.manager.stage.get_name() == 'VideoCallConnecting' or \
runtime.manager.stage.get_name() == 'registering' or \
runtime.manager.stage.get_name() == 'idleregistering':
pass
elif _requested == config.MESG_OUTGOING_CALL:
status.videocall_connecting = status.VideoCallConnectingINV
elif _requested == config.MESG_HANGUP:
pass
elif _requested == config.MESG_SET_DIMENSION:
if config.videocall_debug:
print "$$$ DIMENSION CHANGED!!"
elif _requested == config.MESG_SET_SHARPNESS:
if config.videocall_debug:
print "$$$ Video Quality Set!"
elif _requested == config.MESG_GET_PARAMS: # get frame rate
if runtime.manager.stage.get_name() == 'VideoCallConnected':
runtime.manager.stage.set_detail_fps_info(_mesg1)
elif _requested == config.MESG_GET_STATISTICS:
if config.update_debug:
print 'vdciapp::proc_return_mesg_ex. set SIP result!.. MESG_GET_STATISTICS'
print 'status.stat_reg_status =', _mesg1
print 'status.stat_reg_send_count =', _mesg2
print 'status.stat_reg_receive_count =', _mesg3
print 'status.stat_reg_last_result =', _mesg4
print 'status.stat_reg_last_desc =', _mesg5
status.stat_reg_status = _mesg1
status.stat_reg_send_count = _mesg2
status.stat_reg_receive_count = _mesg3
status.stat_reg_last_result = _mesg4
status.stat_reg_last_desc = _mesg5
#debug 06.06.22 status.stat_reg_last_desc = 'Not Found'
# eicho add 06.05.02
if runtime.manager.stage.get_name() == 'autoconfiguration start':
if config.update_debug:
print 'vdciapp) call setSIPRegister()!!'
runtime.manager.stage.setSIPRegister()
#### SNAPSHOT ####
elif _requested == config.MESG_GET_SNAPSHOT:
import utils
filename = utils.player.videocall_capture()
# KA:[20081111]QA8-7: video capture파일이 생성이 안된 경우
if runtime.manager.stage.get_name() == 'VideoCallConnected':
if not filename:
import uiconfig
runtime.manager.stage.ui.notify_msg_show(msg = _('Picture save failed'))
else:
runtime.manager.stage.ui.notify_msg_show(msg = _('Snapshot stored!'))
utils.file_time_adaptation(filename)#MMW
# KA:[20081111]QA8-7: video capture파일이 생성이 안된 경우 ==
if runtime.manager.find_stage('add last'):
if status.snapshot_editing:
status.phone_item.snapshot = filename
elif runtime.manager.find_stage('modify kind'):
from phonedb import phonedb
if status.editing_phone_number_index == -1:
return
item = phonedb.get_item(status.editing_phone_number_index)
phonedb.update_snapshot(item, filename)
phonedb.save()
elif _result == config.MESG_ERROR: # Error processing
roxia_trace('proc return:error, current stage=', runtime.manager.stage.get_name())
#ka...3800 AEC Error 2007.05.09
if _requested == config.MESG_SET_PARAMS:
print '============= AEC Return ERROR ========== '
# runtime.vdci_send_mesg(code1=config.MESG_HANGUP)
#if runtime.manager.stage.get_name() == 'directvideocalling':
# runtime.manager.stage.invite_error()
return
#Roxia Begin yhcho 06.03.23
if runtime.manager.stage.get_name() == 'callconnecting':
runtime.manager.back_stage(isshow=False)
#Roxia End yhcho
if runtime.manager.stage.get_name() == 'registering':
runtime.manager.stage.register_error()
return
elif runtime.manager.stage.get_name() == 'directvideocalling':
runtime.manager.stage.invite_error()
return
elif runtime.manager.stage.get_name() == 'directaudiocalling':
runtime.manager.stage.invite_error()
return
elif runtime.manager.stage.get_name() == 'incomingvideocall':
runtime.manager.stage.invite_error()
return
# eicho add for warning 121. in NB.
# e|g가 올라오더라도, MMI에는 그대로 표현해 달라는 김선건 선임 요청 (2006-10-24)
# get frame rate # during video call.
elif _requested == config.MESG_GET_PARAMS and runtime.manager.stage.get_name() == 'VideoCallConnected':
print '########################## get e|g from VDCIApp. discard this one!'
runtime.manager.stage.set_detail_fps_info(_mesg1)
return
# end.
if profile.ip_mode == 1:
if runtime.manager.stage.get_name() == 'registering':
status.set_register_mode(status.RegisterError)
return
self.with_error = True
if config.videocall_debug: print '08.21 MESG_HANGUP 7 - proc_return_mesg_ex'
self.end_call()
def proc_server_mesg_ex(self,mesg):
debugLogN("proc_server_mesg_ex")
# shchun : add safety code
_mesg1 = _mesg2 = _mesg3 = _mesg4 = _mesg5 = _mesg6 = _mesg7 = _mesg8 = _mesg9 = _mesg10 = None
_mesg11= _mesg12= _mesg13= _mesg14= _mesg15= _mesg16= _mesg17= _mesg18= _mesg19= None
# end shchun
mlist = mesg.split('|')
_result = mlist[0]
_event = mlist[1]
_chan1 = mlist[2]
_chan2 = mlist[3]
_mesg1 = mlist[4]
_mesg2 = mlist[5]
if len(mlist) > 6: _mesg3 = mlist[6]
if len(mlist) > 7: _mesg4 = mlist[7]
if len(mlist) > 8: _mesg5 = mlist[8]
if len(mlist) > 9: _mesg6 = mlist[9]
if len(mlist) > 10: _mesg7 = mlist[10]
if len(mlist) > 11: _mesg8 = mlist[11]
#ka...3800 codec 2007.04.26
if len(mlist) > 12: _mesg9 = mlist[12]
if len(mlist) > 13: _mesg10 = mlist[13] # Audio payload
# KA: [20071012] TI IMS conference
if len(mlist) > 14: _mesg11 = mlist[14] # Video payload
if len(mlist) > 15: _mesg12 = mlist[15] # Display_name
if len(mlist) > 16: _mesg13 = mlist[16] # TI IMS precondition
# KA: [20071116] TI IMS TEST
if len(mlist) > 17: _mesg14 = mlist[17]
if len(mlist) > 18: _mesg15 = mlist[18]
if len(mlist) > 19: _mesg16 = mlist[19]
if len(mlist) > 20: _mesg17 = mlist[20]
if len(mlist) > 21: _mesg18 = mlist[21]
if len(mlist) > 22: _mesg19 = mlist[22]
#print 'ka...##### _mesg1 =', _mesg1
#print 'ka...##### _mesg2 =', _mesg2
if config.videocall_debug:
print 'SERVER MSG :',_result,_event,_chan1,_chan2,_mesg1,_mesg2
if len(mlist) > 6: print '_mesg3=', _mesg3
if len(mlist) > 7: print '_mesg4=', _mesg4
if len(mlist) > 8: print '_mesg5=', _mesg5
if len(mlist) > 9: print '_mesg6=', _mesg6
if len(mlist) > 10: print '_mesg7=', _mesg7
if len(mlist) > 11: print '_mesg8=', _mesg8
#ka...3800 codec 2007.04.26
if len(mlist) > 12: print '_mesg9=', _mesg9
if len(mlist) > 13: print '_mesg10=', _mesg10
# KA: [20071012] TI IMS conference
if len(mlist) > 14: print '_mesg11=', _mesg11 # Video payload
if len(mlist) > 15: print '_mesg12=', _mesg12 # Display_name
if len(mlist) > 16: print '_mesg13=', _mesg13 # TI IMS precondition
# KA: [20071116] TI IMS TEST
if len(mlist) > 17: print '_mesg14=', _mesg14
if len(mlist) > 18: print '_mesg15=', _mesg15
if len(mlist) > 19: print '_mesg16=', _mesg16
if len(mlist) > 20: print '_mesg17=', _mesg17
if len(mlist) > 21: print '_mesg18=', _mesg18
if len(mlist) > 22: print '_mesg19=', _mesg19
# hcryoo : [20070414_1]
self.stripped_number = ''
if _mesg3.startswith('0034'):
self.stripped_number = _mesg3[4:]
_mesg3 = self.stripped_number
elif _mesg3.startswith('+34'):
self.stripped_number = _mesg3[3:]
_mesg3 = self.stripped_number
elif _mesg3.startswith('34'):
self.stripped_number = _mesg3[2:]
_mesg3 = self.stripped_number
# hcryoo : [20070414_1]==
##################### DISCARD E|C ###########################
# channel 을 assign받지 않은 상태이거나, 비정상적인경우, E|C 처리를 무시한다.
# 단, media 관련 stage에서는, stage 정리가 필요하기 때 문에 (back_stage하지 않으므로)
# 아래처럼 처리. -- echo. 06.11.22
if _event == config.MESG_SERVER_KT_MESSAGE: # message의 경우는 channel 검사를 하지 않음.
pass
elif _event != config.MESG_SERVER_INCOMING and _event != config.MESG_SERVER_STOPMEDIA and \
(int(_chan1) != status.first_active_ch and int(_chan1) != status.second_active_ch and int(_chan1) != 0):
# eicho add 06.11.23
if _event == config.MESG_SERVER_CALL and _result == config.MESG_SERVER_ERROR: # in case of E|C
if not status.trapChecked:
status.trapChecked = True
setting.callErr = setting.callErr + 1
status.callErrorSet = True
runtime.mmiDebug.mmiTrace('VDCIApp: E|C: setting.callErr = ', setting.callErr)
if status.flag_state_incoming_ss : # receiving it after S|S
curr_stage_name = runtime.manager.stage.get_name()
# 아래의 stage들에 E|C 메시지가 오면, 무시하지 말고, missed call 처리해준다.
if curr_stage_name == 'photorelatedstage' or curr_stage_name =='audiorelatedstage' or curr_stage_name == 'audioreadystage' \
or curr_stage_name == 'videorecorddonestage' or curr_stage_name =='videorecordstage' or curr_stage_name =='video preview' :
print '## MEDIA RELATED STAGES !!!##'
# eicho modify 06.11.23
old_exiting = self.exiting
self.exiting = False
runtime.manager.kill_ringer()
runtime.manager.handle_missing_call()
#pass
elif curr_stage_name == 'videoplaystage' or curr_stage_name == 'video gallery' or \
curr_stage_name == 'recordevideo' or curr_stage_name=='videogalleryoptionstage':
print '## VIDEO RELATED STAGES !!!##'
old_exiting = self.exiting
self.exiting = False
runtime.manager.kill_ringer()
runtime.manager.handle_missing_call()
else:
# add 06.11.22
print '## get E|C MESG_SERVER_CALL !!!! ##, status.flag_state_incoming_ss=', status.flag_state_incoming_ss
# hcryoo : [20070416_1]
status.not_screen_saver = False
setting.reset_screen_saver_timer()
status.screensaver_activated = False
# hcryoo : [20070416_1]==
self.remove_ss_sw_timer()
return True
################ SERVER EVENT: SUCCESS ##################
#elif _result == config.MESG_SERVER_NOERROR: # Server message: normal
if _result == config.MESG_SERVER_NOERROR: # Server message: normal
################# MESG_SERVER_REGISTER ##################
if _event == config.MESG_SERVER_REGISTER:
# KA: [20080420] new register -- 중복 등록 / De-regi
if (_mesg2 == '2' and _mesg3 == '6') or (_mesg2 == '2' and _mesg3 == '8'):
import basemodel, uiconfig
msg = _('De-registered.\nPress the call button if you want register.')
# do not change mmi stage on running browser
curr_stage_name = runtime.manager.stage.get_name()
if ((curr_stage_name == 'myann') or (runtime.manager.find_stage('myann'))):
print "[vdciapp] do nothing on running browser"
return
stage = basemodel.NotifyStage(msg, uiconfig.baloon_setting_voip_icon)
runtime.manager.change_stage(stage, True)
return
else:
pass
# KA: [20080414] dect base reset 시 BASE의 상태를 알려주기 위해
# registration success
runtime.manager.set_registerinfo('0')
if status.FirstRegistered_check_flag_for_QoS_setting == False:
status.FirstRegistered_check_flag_for_QoS_setting = True
if setting.subscriber == 0:
if runtime.vdciapp:
runtime.vdciapp.send_mesg(code1=config.MESG_SET_PARAMS, \
code2=config.MESG_GET_QoS_Marking, mesg1=2, mesg2=0)
else:
print '@@@@ QoS disabling Failed.'
# KA: [20071105] TI IMS subscriber
#if _mesg3 in ('1', '2', '3', '4', '5', '6', '7', '8', '9'):
# print 'ka......ServerNotiToSubscriber ######### _mesg3=', _mesg3
# import phonesetting
# phonesetting.ServerNotiToSubscriber(_mesg3)
# KA: [20071105] TI IMS subscriber ==
if runtime.manager.stage.get_name() == 'VideoCallConnecting':
if profile.ip_mode == 0: # pstn mode by right.
if runtime.manager.stage.get_register_timer() != None:
runtime.manager.stage.remove_register_timer()
status.videocall_connecting = status.VideoCallConnectingREG
runtime.manager.stage.request_invite()
elif runtime.manager.stage.get_name() == 'registering' or \
runtime.manager.stage.get_name() == 'idleregistering' or \
runtime.manager.stage.get_name() == 'autoregistering' or \
runtime.manager.stage.get_name() == 'DeRegistering' or \
runtime.manager.stage.get_name() == 'config autoregistering' or \
runtime.manager.stage.get_name() == 'deregistering':
# Register success
if _mesg2 == '1':
runtime.manager.stage.register_sucessed()
# registering 수행중일때만 telnum갱신한다.
# register 상태가 update일때는 telnum갱신하지 않는다
# amigo dice: register요청의 결과인 (S|R)와 register상태갱신 메시지(S|U)의 분리가 필요함
status.set_telnum()
from trapManager import TrapHandler
runtime.trapHandler.sendSipRegisterTrap(TrapHandler.REG_SUCCESS)
# De-Register success
elif _mesg2 == '0':
debugLogN('DEREG-OK')
if runtime.manager.stage.get_name() == 'idleregistering' or \
runtime.manager.stage.get_name() == 'autoregistering':
runtime.manager.stage.deregister_sucessed()
self.set_register_status(False) # unregistered
from trapManager import TrapHandler
runtime.trapHandler.sendSipRegisterTrap(TrapHandler.REG_FAILURE)
#MMW 2008.07.10 send deregi to DCP
# runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
# runtime.dectCallManager.unregisterstatusReport()
#end of MMW
return True
else:
#register실패한 이후에 vdciapp에서 register한 경우
if profile.ip_mode == 1 and status.telnum == '':
from vdcisetting import vdci_setting
status.telnum = vdci_setting.tel_num
# deregister 인 경우
if _mesg2 == '0':
return
if config.global_version_flag == 0: # do not subscribe if global version hdkim 20081030
if not self.subscriber_success:
self.retry_subscriber_count = 0
runtime.vdciapp.req_subscriber()
##### KA: register 성공에 관한 status처리는 이곳에서 해야 합니다.
debugLogN('REG-OK: idle clear')
self.set_register_status(True)
errorcode.set_idle_errmsg('', refresh=True)
status.register_proxy = _mesg4
# KA: [20080414] dect base reset 시 BASE의 상태를 알려주기 위해
# registration success -> 0
runtime.manager.set_registerinfo('0')
status.dnsPingCount = False
'''
from trapManager import TrapHandler
runtime.trapHandler.sendSipRegisterTrap(TrapHandler.REG_SUCCESS)
'''
#if status.get_regstatus() == 0: # fail -> success: 상태가 변경된 경우에만 VM regi event를 날린다.
runtime.vmHandler.ERR_SIP_REGISTERED()
#runtime.mmiDebug.mmiTrace('재 등록 성공 시에는 DECT로 알리지 않는다.')
if runtime.dectCallManager.isSubcribedDect():
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_SUCCESS)
runtime.vmHandler.setTerminalInformation()
runtime.eaHandler.updateCookiesFromWap(sip=True)
################# MESG_SERVER_NOTIFICATION ##################
elif _event == config.MESG_SERVER_NOTIFICATION:
setting.set_mwi_waiting(int(_mesg1))
status.mwi_normal_new = int(_mesg2)
status.mwi_normal_old = int(_mesg3)
status.mwi_urgent_new = int(_mesg4)
status.mwi_urgent_old = int(_mesg5)
status.mwi_notification_window =int( _mesg1)
runtime.manager.handle_mwi_waiting()
#########################
# answer delay 수정분 - 06.05.30
#########################
################# MESG_SERVER_STOPMEDIA ##################
# S|S가 올라오면 현재 play중인 media를 stop한다.
elif _event == config.MESG_SERVER_STOPMEDIA:
if config.videocall_debug:
print 'debug)) get S|S from VDCIApp. stop media.'
print 'setting.video_supervision_enable = ', setting.video_supervision_enable
print '_mesg1 = ', _mesg1
print '_mesg2 = ', _mesg2
print '_mesg3 = ', _mesg3
print 'setting.supervision_number = ', setting.supervision_number
import utils
# initialize status.incoming_umts_call - add 06.06.14
if _mesg2 == '1':
status.incoming_umts_call = True
else:
status.incoming_umts_call = False
##### CHECK 06.11.14
self.remove_ss_sw_timer()
##### end.
if status.FromDiffNetwork():
pass
elif status.special_cid == True:
pass
elif profile.ip_mode == 0 and \
(status.first_video_mode == status.VideoIncoming or \
status.second_video_mode == status.VideoIncoming):
pass
elif status.first_video_mode != status.VideoIdle and \
status.second_video_mode != status.VideoIdle:
# both channels are in use
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
elif status.first_video_mode == status.VideoIdle and \
status.second_video_mode == status.VideoIdle:
# IDLE - first call (go to next step)
pass
# eicho add 06.11.28
elif runtime.manager.stage.get_name() == 'IncomingDisconnected':
# both channels are in use, one call is disconnecting.
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else: # second call.
if _mesg1 == '0':
# hcryoo : [20070521_2]
#if status.heldline:
if status.get_held_flag(status.active_call_index):
if config.videocall_debug: print 'S|S debug ==> second audio call in held status - reject.'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else:
# allows second audio call.
if config.videocall_debug: print 'S|S debug ==> case 10: accept second audio call - (I|S) '
if status.dial_number == _mesg3: # 같은 번호로 outgoing 중.
if config.videocall_debug: print 'S|S debug ==> case 11: reject second audio call because of on-outgoing(',status.dial_number,')'
#self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1))
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else:
# 06.11.14 status.call_status = status.IncomingCall
status.On_flag_incoming_ss()
status.caller_number = _mesg3
status.display_caller_number(0)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1))
# eicho add 06.11.28
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer)
# hcryoo : [20070521_2]==
else:
# reject second video incoming (I|R)
if config.videocall_debug: print 'S|S debug ==> case 9: second video call - reject.'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
## eicho add 06.11.06
if runtime.browserapp: # browsing중 call - supervision인 경우, call reject. 아니면 call 진행 - stop browsing
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number and _mesg1 != '0':
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# supervision video call
#pass # pass for now. The call be rejected at this step
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
else:
runtime.evas.render_now()
os.system('fb0top 1')
runtime.browserapp.destroy()
runtime.browserapp = None
if runtime.updComm:#update action 중 call - supervision인경우에는 콜 reject. 아니면, call 진행 - stop download.
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number and _mesg1 != '0':
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# downloading -
#pass # pass for now. The call will be rejected at next step
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
else:
try:
runtime.updComm.destroy()
runtime.updComm = None
#runtime.manager.pop_stage.destroy()
except AttributeError:
pass
## end.
## handling normal call
if _mesg1 == '0': # S|S for audio call.
#_mesg2 = ''
ret = utils.player.check_stop_media()
if ret : # success to stop media (I|S)
##### CHECK 06.11.14
status.On_flag_incoming_ss()
status.caller_number = _mesg3
## modify for not general stage. just for stage only related media
## 06.11.17
# modify 06.11.21
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
curr_stage_name = runtime.manager.stage.get_name()
if curr_stage_name == 'photorelatedstage' or curr_stage_name =='audiorelatedstage' or curr_stage_name == 'audioreadystage' :
#or curr_stage_name == 'videorecorddonestage':
runtime.manager.back_stage()
##### end.
if config.videocall_debug: print 'S|S debug ==> case 1: audio call - success to stop media. I|S'
# eicho add 06.11.13
print '### vdciapp.py - S|S status.phone_status = ', status.phone_status, ' / status.Disconnected=', status.Disconnected
if status.phone_status != status.Disconnected and \
(runtime.manager.stage.get_name() == 'VideoCallTerminated' or runtime.manager.stage.get_name() == 'AudioCallTerminated'):
if config.videocall_debug: print 'S|S debug ==> case 12: on releasing a prev.call /(not disconnected yet) so Reject.'
# (I|R)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
# end.
status.call_status = status.IncomingCall
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1))
else: # otherwise (I|R)
if config.videocall_debug: print 'S|S debug ==> case 2: audio call - fail to stop media. I|R => NOT NORMAL'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
return True
# S|S for video call
ret = utils.player.is_using_media()
if ret : # VP's using Media
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number:
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# supervision call is coming.
if config.videocall_debug: print 'S|S debug ==> case 3: video call - using media and reject supervision.(I|R)'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else:
# not supervision call -should stop process related media
ret = utils.player.check_stop_media()
if ret : # success to stop media (I|S)
##### CHECK 06.11.14
status.On_flag_incoming_ss()
status.caller_number = _mesg3
## modify for not general stage. just for stage only related media
## 06.11.17
# modify 06.11.21
curr_stage_name = runtime.manager.stage.get_name()
if curr_stage_name == 'photorelatedstage' or curr_stage_name =='audiorelatedstage' or curr_stage_name == 'audioreadystage' :
runtime.manager.back_stage()
##### end.
if config.videocall_debug: print 'S|S debug ==> case 4: video call - using media and success to stop media (I|S)'
status.call_status = status.IncomingCall
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1))
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
else : # otherwise (I|R)
if config.videocall_debug: print 'S|S debug ==> case 5: video call - using media and fail to stop media (I|R) => NOT NORMAL'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else: # not using Media.
#### 06.08.21 # prohibit 2nd incoming call when first call is terminating.
if runtime.manager and (runtime.manager.stage.get_name() == 'VideoCallTerminated'):
if config.videocall_debug: print 'S|S debug ==> case 12: second incoming during terminating video. reject.(I|R)'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
status.On_flag_incoming_ss()
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
#if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number:
#### end.
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
elif setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number:
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# supervision call is coming.
if runtime.dspg.get_state() == runtime.dspg.ST_IDLE and status.supervision_not_allowed == 0 and status.update_section == False:
# possible to videosupervision.
# (I|S)
# eicho 06.08.21
os.system('fb0top 1')
# end.
if config.videocall_debug: print 'S|S debug ==> case 6: video call - NOT use media and supervision call is coming (I|S)'
status.call_status = status.IncomingCall
### eicho CHECK 06.11.14
status.On_flag_incoming_ss()
#status.set_caller_number(_mesg3)
status.caller_number = _mesg3
#ka...3800 Slim Supervion preload시에 RX를 mute시킴 mesg=1 2007.05.14
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1), mesg1=1)
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
else: # not possible! reject supervision call.
# (I|R)
if config.videocall_debug: print 'S|S debug ==> case 7: video call - NOT use media and reject supervision call (I|R)'
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else:
# not supervision call - should go to next step
# (I|S)
# eicho 06.08.21
os.system('fb0top 1')
# end.
if config.videocall_debug: print 'S|S debug ==> case 8: video call - NOT use media and normal video call (I|S)'
status.call_status = status.IncomingCall
### eicho CHECK 06.11.14
status.On_flag_incoming_ss()
#status.set_caller_number(_mesg3)
status.caller_number = _mesg3
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_STARTUP, chan1=int(_chan1))
self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
# answer delay 수정분 end. - 06.05.30
#####################################
################# MESG_SERVER_INCOMING ##################
# MESG_SERVER_INCOMING_AUDIO 메시지 없어짐.
# IncomingVideoCallStage, IncomingAudioCallStage를 통합.
# MESG_SERVER_INCOMING, msg1 or msg2 표시
################## S|W| ...#############################
# 100 TRYING 전송 후에 발생
elif _event == config.MESG_SERVER_INCOMING: #KEON-0413
roxia_event('received MESG_SERVER_INCOMING')
if runtime.eaHandler.getBankInUse():
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_BUSY_HERE)
status.release_channel()
import calldb, ntptime
calldb.add_call_log('missed', _mesg3, ntptime.ntime(), 0, 0, 0)
return
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if _mesg16: # DHCP 이용시 사용 중 한 IP 에 다른 번호가 등록된 경우가 발생 할 경우 : 로그 남기지 않음.
from vdcisetting import vdci_setting
telNo = vdci_setting.tel_num
if telNo != _mesg16 and not config.local_test_flag:
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_TEMPORARILY_UNAVAILABLE)
status.release_channel()
return
else: # IP 로 전화가 오는 경우 : 로그 남기지 않음.
if not status.get_regstatus_mmi():
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_TEMPORARILY_UNAVAILABLE)
status.release_channel()
return
#send busy when in provisioning status
if config.Provision_enable == True:
if status.snmp_start or runtime.manager.provision_manager.isProvisioning() == True:
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_BUSY_HERE)
status.release_channel()
#status.reset_call_status()
return
else :
if status.snmp_start :
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_BUSY_HERE)
status.release_channel()
#status.reset_call_status()
return
if status.slideshow_running:
setting.stop_slideshow()
setting.voipOrgCall = setting.voipOrgCall + 1
runtime.mmiDebug.mmiTrace('number of voipOrgCall = ', setting.voipOrgCall)
# pstn, videocall, incoming: "name"을 보여주지 않음
status.heldline = 0
##### CHECK 06.11.14
self.remove_ss_sw_timer()
##### end.
if profile.ip_mode == 0: # pstn
_mesg2 = ''
#ka...3800 2007.05.10 S|S메시지를 받지 않고 바로 S|W을 받으므로 여기서 Media 정리!
# if os.access('/var/run/vengine.id', os.R_OK):
# utils.player.stop_media()
#### 06.08.21 # prohibit 2nd incoming call when first call is terminating.
# if runtime.manager and (runtime.manager.stage.get_name() == 'VideoCallTerminated'):
# if config.videocall_debug: print 'S|S debug ==> case 12: second incoming during terminating video. reject.(I|R)'
# self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
# chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
# status.On_flag_incoming_ss()
# self.no_response_timer = utils.Timer(5000, self.remove_ss_sw_timer) # add 06.11.28
if runtime.browserapp:
# eicho modify 06.06.07
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number and _mesg1 != '0':
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# supervision video call
pass # pass for now. The call will be rejected at next step
else:
runtime.evas.render_now()
os.system('fb0top 1')
runtime.browserapp.destroy()
runtime.browserapp = None
MD.mmiTrace('status.first_video_mode = ', status.first_video_mode)
MD.mmiTrace('status.second_video_mode = ', status.second_video_mode)
if runtime.updComm:#update action 중 call
# eicho modify 06.06.07
# hcryoo : [20070414_1]
# hcryoo : [20070420_1]
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number and _mesg1 != '0':
# hcryoo : [20070420_1]==
# hcryoo : [20070414_1]==
# supervision video call
pass # pass for now. The call will be rejected at next step
else:
try:
runtime.updComm.destroy()
runtime.updComm = None
#runtime.manager.pop_stage.destroy()
except AttributeError:
pass
# replaced MESG_SERVER_INCOMING block
if status.FromDiffNetwork():
if _mesg3 != status.indirect_cid:
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, \
chan1=int(_chan1), mesg1=config.REASON_LINE_BUSY)
else:
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, mesg1=config.NOT_SUPERVISION_CALL)
elif status.special_cid == True:
if _mesg3.lower() == 'anonymous':
status.set_caller_number('')
status.set_service_name(_('Private'))
elif _mesg3.lower() == 'unavailable':
status.set_caller_number('')
status.set_service_name(_('Private'))
else:
status.set_caller_number(_mesg3)
status.set_service_name(_mesg2)
if _mesg1 == '0': # media is audio
status.set_video_mode(status.AudioIncoming)
else:
status.set_video_mode(status.VideoIncoming)
status.assign_incoming_channel(_chan1)
import model
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5))
elif profile.ip_mode == 0 and \
(status.first_video_mode == status.VideoIncoming or \
status.second_video_mode == status.VideoIncoming):
status.assign_incoming_channel(_chan1)
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
#runtime.vdci_stop_tone()
runtime.SP_context.stopTonePlay()
import utils
utils.player.stop_message()
if runtime.manager.stage.get_name() != 'SupervisionConnected':
runtime.dspg.change_to_conv()
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, mesg1=config.NOT_SUPERVISION_CALL)
elif status.first_video_mode == status.VideoIdle and status.second_video_mode == status.VideoIdle and dectStatus == DectCallManager.IDLE:
status.business_option_status = status.NotSelected
status.waiting = 0
if _mesg3.strip().lower() == 'anonymous':
status.set_service_name(_('anonymous'))
else:
status.set_service_name(_mesg2)
status.set_caller_number(_mesg3)
status.assign_incoming_channel(_chan1)
#print 'ka...._######### TEST Home Monitering'
#_mesg15 = '9'
# KA:[20081013] 영상 모니터링
if _mesg15 == '9':
status.set_video_mode(status.VideoIncoming)
# reject (VM 사용중 / base, dect 가 Idle이 아닌경우)
if runtime.eaHandler.isAppInUse():
#not (baseStatus == SP_Context.IDLE and dectStatus ==DectCallManager.IDLE):
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_BUSY_HERE)
status.release_channel()
status.clear_current_call_status(clearVideoCallTime=False)
status.reset_call_status()
# supervision
else:
import model
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
runtime.manager.change_stage(model.HMIncomingStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5))
return
# KA:[20081013] 영상 모니터링 ==
######## my card 2008.05.23
self.myCardInfo = None
if config.mmcid:
if _mesg6.find('http://') != -1:
mmcidMessage = _mesg6
#mmcidMessage= '<http://soipmcid.ktann.com/mycard/card/mycard/mycard_00000128.gif> ;purpose=icdn,<http://soipmcid.ktann.com/cid/c5e5ddb7816448abecbaf4fa546eee3e.txt> ;purpose=text'
mmcidSubMessages = mmcidMessage.split(',')
self.mmcidList = []
self.myCardImageInfo = None
for mmcidSubMessage in mmcidSubMessages:
mmcidAddress, mmcidPurpose = mmcidSubMessage.split(';')
if mmcidPurpose.split('=')[1] == 'icon':
myCardImageAddress = mmcidAddress[mmcidAddress.find('http'):mmcidAddress.rfind('>')]
runtime.mmiDebug.mmiTrace('myCardImageAddress ==> ', myCardImageAddress)
extension = myCardImageAddress[myCardImageAddress.rfind('.')+1:]
runtime.mmiDebug.mmiTrace('extension ==> ', extension)
try:
import urllib
myCardImageFileHandler = urllib.urlopen(myCardImageAddress)
myCardImageData = myCardImageFileHandler.read()
myCardImageFileHandler.close()
# 0x47 0x49 0x46
if extension == 'gif':
myCardImageFile = open('/usr/local/lgvp/images/myCard/myCardImage.gif', 'w')
myCardImageFile.write(myCardImageData)
myCardImageFile.close()
import os
os.system('myCard.sh')
import time
time.sleep(1)
import utils
self.myCardImageInfo = utils.getGifAnimationInfo()
elif extension == 'jpg':
myCardImageFile = open('/usr/local/lgvp/images/myCard/myCardImage.jpg', 'w')
myCardImageFile.write(myCardImageData)
myCardImageFile.close()
self.myCardImageInfo = ['./myCard/myCardImage.jpg', '1', '0', []]
elif extension == 'png':
myCardImageFile = open('/usr/local/lgvp/images/myCard/myCardImage.png', 'w')
myCardImageFile.write(myCardImageData)
myCardImageFile.close()
self.myCardImageInfo = ['./myCard/myCardImage.png', '1', '0', []]
except:
defaultMyCardImageFile = open('/usr/local/lgvp/images/defaultMyCard.jpg')
myCardImageData = defaultMyCardImageFile.read()
defaultMyCardImageFile.close()
myCardImageFile = open('/usr/local/lgvp/images/myCard/myCardImage.jpg', 'w')
myCardImageFile.write(myCardImageData)
myCardImageFile.close()
self.myCardImageInfo = ['./myCard/myCardImage.jpg', '1', '0', []]
elif mmcidPurpose.split('=')[1] == 'text':
myCardTextAddress = mmcidAddress[mmcidAddress.find('http'):mmcidAddress.rfind('>')]
runtime.mmiDebug.mmiTrace('myCardTextAddress = ', myCardTextAddress)
try:
import urllib
myCardTextFileHandler = urllib.urlopen(myCardTextAddress)
self.myCardText = myCardTextFileHandler.read()
self.myCardText = unicode(self.myCardText, 'euc-kr').encode('utf-8')
self.myCardText = self.myCardText.replace('\r', '')
self.myCardText = self.myCardText.replace('\n', '')
myCardTextFileHandler.close()
except:
self.myCardText = unicode('믿음과 소망과 사랑 중에 그 중에 제 일이 사랑이라!!!', 'euc-kr').encode('utf-8')
self.myCardInfo = [self.myCardImageInfo, self.myCardText]
runtime.mmiDebug.mmiTrace('self.myCardInfo ==> ', self.myCardInfo)
# check the usage of application
from eaHandler import EaNotifyStage
if runtime.eaHandler.isAppInUse():
self.vmIncomingData =None
currentName = runtime.eaHandler.getDestination().getName()
MD.mmiTrace('currentName = ', currentName)
if currentName == 'MULTIMEDIA':
runtime.manager.stack_stage(EaNotifyStage('AudoCall : In Use By MULTIMEDIA'))
runtime.eaHandler.activateApplicationByCall(source=currentName, destination='MMI')
# 상태는 Incoming - second busy처리하기 위해
if _mesg1 == '0':
status.set_video_mode(status.AudioIncoming)
else:
status.set_video_mode(status.VideoIncoming)
# Save해둬야 할 값들은
self.vmIncomingData = int(_chan1), _mesg1, _mesg2, _mesg3, _mesg4, _mesg5
return
elif currentName == 'BROWSER':
# 교통정보 사용중인 경우에는 VC02를 Clear해준다.
#if runtime.eaHandler.isShowingTraffic():
runtime.eaHandler.stopTraffic()
runtime.manager.stack_stage(EaNotifyStage('AudoCall : In Use By BROWSER'))
runtime.eaHandler.activateApplication(source=currentName, destination='MMI')
elif currentName == 'MMSC':
runtime.manager.stack_stage(EaNotifyStage('AudoCall : In Use By MMSC'))
runtime.eaHandler.activateApplicationByCall(source=currentName, destination='MMI')
# 상태는 Incoming - second busy처리하기 위해
if _mesg1 == '0':
status.set_video_mode(status.AudioIncoming)
else:
status.set_video_mode(status.VideoIncoming)
# Save해둬야 할 값들은
self.vmIncomingData = int(_chan1), _mesg1, _mesg2, _mesg3, _mesg4, _mesg5
return
else: #BANK: 위에서 486 busy / MMI:(VM or Alarm 이 울리는 경우)
pass
current_stage_name = runtime.manager.stage.get_name()
if current_stage_name == 'AudioCallTerminated' or current_stage_name == 'VideoCallTerminated':
# 호 종료 시 busytone 처리되는 상황을 정리하기 위한 것.
runtime.SP_context.stopTonePlay()
if _mesg1 == '0': # media is audio
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
status.set_video_mode(status.AudioIncoming)
import model
current_stage_name = runtime.manager.stage.get_name()
runtime.mmiDebug.mmiTrace('current stage : ' , current_stage_name)
if current_stage_name == 'copyfromstage' or current_stage_name == 'copytostage':
runtime.manager.back_stage()
if setting.autoAnswer:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, '2', self.myCardInfo))
else:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5, self.myCardInfo))
else: # video call or supervision
status.set_video_mode(status.VideoIncoming)
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number:
if runtime.dspg.get_state() == runtime.dspg.ST_IDLE and status.supervision_not_allowed == 0 and status.update_section == False:
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
# supervision
import tdeservice
runtime.manager.stack_stage(tdeservice.SupervisionConnectedStage(runtime.manager.stage.get_name(), runtime.manager.stage.ui))
else: # reject. someone else is using the phone
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_LINE_BUSY)
status.release_channel()
status.clear_current_call_status(clearVideoCallTime=False)
status.reset_call_status()
else:
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
import model
if setting.autoAnswer:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, '2', self.myCardInfo))
else:
debugLogN('** change ** Incomingcall stage')
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5, self.myCardInfo))
else: # second incoming call
status.toggle_active_call()
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.INCOMING_AUDIO]:
status.clear_current_call_status(clearAudioCallTime=False)
else:
status.clear_current_call_status(clearVideoCallTime=False)
if _mesg1 == '0': # media is audio
status.set_video_mode(status.AudioIncoming)
else:
status.set_video_mode(status.VideoIncoming)
status.assign_incoming_channel(_chan1)
if _mesg3.lower() == 'anonymous':
status.set_caller_number('')
status.set_service_name(_('Private'))
elif _mesg3.lower() == 'unavailable':
status.set_caller_number('')
status.set_service_name(_('Private'))
else:
status.set_caller_number(_mesg3)
status.set_service_name(_mesg2)
status.save_current_call_status()
#status.toggle_active_call()
status.set_current_call_status()
roxia_event('Second call incoming')
roxia_event('active_call_index: ', status.active_call_index)
roxia_event('current channel: ',status.first_active_ch, '/', status.second_active_ch)
roxia_event('current video mode: ', status.first_video_mode, '/', status.second_video_mode)
#baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if baseStatus == SP_Context.TRANSFER_RINGING or dectStatus == DectCallManager.TRANSFER_RINGING:
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_TEMPORARILY_UNAVAILABLE)
import calldb, ntptime
calldb.add_call_log('missed', _mesg3, ntptime.ntime(), 0, 0, 0)
status.release_channel()
status.reset_call_status()
status.toggle_active_call()
status.set_current_call_status()
return
isSecondCall = False
if _mesg15 == '4':
# KA: [20080722] Second caller number - for callDB: 번호 저장
import ntptime
status.second_info_accept = False
status.second_info_number = _mesg3
status.second_info_time = ntptime.ntime()
print 'ka...Second Incoming: number=%s / time=%s'%(status.second_info_number, status.second_info_time)
# KA: [20080722] Second caller number - for callDB: 번호 저장 ==
if baseStatus == SP_Context.CONNECTED and \
(runtime.manager.stage.get_name() == 'AudioCallConnected' or \
runtime.manager.stage.get_name() == 'VideoCallConnected' or \
runtime.manager.find_stage('AudioCallConnected') or \
runtime.manager.find_stage('VideoCallConnected') ):
if runtime.manager.find_stage('AudioCallConnected'):
runtime.manager.back_stage('AudioCallConnected')
elif runtime.manager.find_stage('VideoCallConnected'):
runtime.manager.back_stage('VideoCallConnected')
if runtime.dectCallManager.isSubcribedDect() and dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.sendCidType2('', _mesg3)
if _mesg3.find('anonymous') != -1:
import uiconfig
runtime.manager.stage.showSecondCallNumber('')
else:
runtime.manager.stage.showSecondCallNumber(_mesg3)
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
if _mesg1 == '0': # media is audio
status.second_info_call_mode = 0
else:
status.second_info_call_mode = 1
isSecondCall = True
elif runtime.dectCallManager.isSubcribedDect() and \
baseStatus != SP_Context.CONNECTED and dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.sendCidType2('', _mesg3)
if setting.in_restrict and (_mesg3 in setting.in_restrict_nums):
#baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
#from dectHandler import DectCallManager
if dectStatus == DectCallManager.CONNECTED:
runtime.dectCallManager.sendRestrictedNumberSign(_mesg2, _mesg3)
roxia_event('vdciapp.py second incoming: release channel')
#status.toggle_active_call()
#status.set_current_call_status()
if setting.in_restrict and (_mesg3 in setting.in_restrict_nums):
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_TEMPORARILY_UNAVAILABLE)
import calldb, ntptime
calldb.add_call_log('missed', _mesg3, ntptime.ntime(), 0, 0, 0)
else:
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_BUSY_HERE)
status.release_channel()
status.reset_call_status()
status.toggle_active_call()
status.set_current_call_status()
################# MESG_SERVER_CALL ##################
# video/audio call 여부를 알수있음: mesg1(0:audio, 1:video)
elif _event == config.MESG_SERVER_CALL:
# video call인경우 dimension 변경
#if _mesg1 == '1':
# 발신:수신자가mobile /수신:발신자가 mobile
#if status.dial_number[:4] == '*010' or _mesg6[:3] == '010':
# status.videocall_dimension_mobile = True
# runtime.vdciapp.changeDimension()
#else:
# status.videocall_dimension_mobile = False
# 영상 광고시 (Audiocall연결) Tx영상을 보내지 않기 위해 메시지를 보낸다.
'''
if _mesg7 == '1':
def RtpTxMute():
self.rtpTxTimer = None
self.send_mesg(code1='p', code2='r', mesg1='1', mesg2='1')
return
import utils
self.rtpTxTimer = utils.Timer(config.RtpTxMuteTimer, RtpTxMute)
'''
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if runtime.dectCallManager.isSubcribedDect():
if dectCallStatus == DectCallManager.OUTGOING_AUDIO or dectCallStatus == DectCallManager.OUTGOING_VIDEO:
if dectStatus == DectCallManager.CONNECTING or dectStatus == DectCallManager.RINGBACK:
runtime.dectCallManager.connectCall()
runtime.dectCallManager.setDectStatus(DectCallManager.CONNECTED)
if not status.trapChecked:
status.trapChecked = True
setting.callSucc = setting.callSucc + 1
runtime.mmiDebug.mmiTrace('VDCIApp:S|C:setting.callSucc = ', setting.callSucc)
runtime.trapHandler.setCallResult(1)
old_exiting = self.exiting
self.exiting = False
# KA: [20071126] DTMF nego
if status.get_current_channel() == int(_chan1):
status.set_dtmf_type(int(_mesg4))
else:
status.toggle_active_call()
status.set_current_call_status()
status.set_dtmf_type(int(_mesg4))
status.toggle_active_call()
status.set_current_call_status()
# KA: [20071126] DTMF nego ==
'''
if _mesg6:
if len(_mesg6) > 25:
status.set_caller_number(status.display_caller_number(status.active_call_index))
status.set_service_name(status.display_caller_name(status.active_call_index))
else:
if _mesg6.lower() == 'anonymous':
status.set_caller_number('')
status.set_service_name(_('anonymous'))
else:
status.set_caller_number(_mesg6)
status.set_service_name(_mesg12)
# 호 전환 시 번호가 달라지는 것을 표시하기 위한 것.
if _mesg6 != status.caller_number:
runtime.manager.stage.changeConnectedNumber()
'''
if _mesg10:
runtime.SP_context.setWidebandCodecFlag(_mesg10)
# setWideBand적용 해주기 위해
devices = runtime.SP_context.getCurrentDevice()
for device in devices:
#from mmiSoundPath import SP_State
#if device == SP_State.DEVICE_HS:
# volume = setting.handset_volume
#elif device == SP_State.DEVICE_SPK:
# volume = setting.speaker_volume
runtime.SP_context.setBandwidthMode(device)
#runtime.SP_context.setDeviceVolume(device, volume)
status.call_type = int(_mesg1)
#runtime.vdci_stop_tone()
#runtime.SP_context.stopTonePlay()
MD.mmiTrace('runtime.manager.stage.get_name() = ', runtime.manager.stage.get_name())
if runtime.manager.stage.get_name() == 'HandsFreeNotify':
runtime.manager.back_stage()
elif runtime.manager.stage.get_name() == 'DisconnectNotify':
runtime.manager.back_stage()
elif runtime.manager.stage.get_name() == 'IncomingDisconnected':
runtime.manager.stage.next()
if runtime.manager.stage.get_name() == 'callconnecting':
runtime.manager.back_stage(isshow=False)
if runtime.manager.stage.get_name() == 'incomingcall':
runtime.manager.stage.invite_sucessed(int(_mesg1))
elif runtime.manager.stage.get_name() == 'HMIncoming':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'directvideocalling':
runtime.manager.stage.invite_sucessed(int(_mesg1), int(_mesg2)) # vpark 09.15
elif runtime.manager.stage.get_name() == 'incomingvideocall':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'directaudiocalling':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'incomingaudiocall':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'VideoCallRequested':
if config.videocall_debug:
print '*** MESG_CALL_REINVITE for Requested***'
import model
runtime.manager.change_stage(model.VideoCallConnectedStage)
# hcryoo : [20070419_1]
elif runtime.manager.stage.get_name() == 'VideoCallRequestedForCallTrading' or \
runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading':
if config.videocall_debug:
print '*** CALL TRADING response ***'
import model
if _mesg1 == '1':
runtime.manager.change_stage(model.VideoCallConnectedStage)
else:
runtime.manager.stage.video_call_declined()
# hcryoo : [20070419_1]==
# hcryoo : [20070501_1]
elif runtime.manager.stage.get_name() == 'VideoCallConnected':
if status.KT_CALL_TESTER:
baseStatus = runtime.SP_context.getBaseStatus()
baseCallStatus = runtime.SP_context.getBaseCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO] and baseStatus == SP_Context.CONNECTED:
runtime.manager.stage.removeCallTest_CB()
if config.roxia_event:
print 'VDCIAPP : VideoCallConnected'
print 'runtime.manager.stage.get_name() = ', runtime.manager.stage.get_name()
# 이전에 수신자 부담 전화에서 reinvite 처리를 위해 만든 소스인데 삭제할 경우 음성 3인통화에 문제가 생긴다.
if _mesg1 == '0':
import model
runtime.manager.stage.stopCallDuration()
runtime.manager.change_stage(model.AudioCallConnectedStage)
# 영상광고 수신중에 SecondCall받고 stage전환하면서 SecondCall정보 사라지는 문제 수정
if status.second_info_number:
runtime.manager.stage.showSecondCallNumber(status.second_info_number)
#else: 영상광고 수신중에 HookFlash를 눌러 3자 통화시도하고자 할 경우
# hcryoo : [20070501_1]==
elif runtime.manager.stage.get_name() == 'SecondCallConnecting':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'OptionsIP':
#ka...slim 2007.05.26 Conference중에 S|C 올라오면 무시
if status.business_call_status in (status.TwoCallConnected, status.TwoCallOneIncoming, status.TwoCallOneHold):
pass
else:
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'SecondIncomingCall':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'SupervisionConnected':
runtime.manager.stage.invite_sucessed() # vpark 10.24
elif runtime.manager.stage.get_name() == 'AudioCallConnecting':
import model
runtime.manager.stack_stage(model.AudioCallConnectedStage)
elif runtime.manager.stage.get_name() == 'AudioCallConnected':
import model
if status.call_type == 1:
# [20080904_1] : hcryoo : [QA 5-50] 자동응답 설정 폰에서 2G로 3인통화를 하다 취소하면 자동응답이 발생한다.
if not status.pushVideoAd and baseCallStatus != SP_Context.OUTGOING_VIDEO:
runtime.SP_context.setBaseCallStatus(SP_Context.INCOMING_VIDEO)
runtime.manager.change_stage(model.VideoCallConnectedStage, True)
# [20080904_1] : hcryoo : [QA 5-50] 자동응답 설정 폰에서 2G로 3인통화를 하다 취소하면 자동응답이 발생한다.==
if status.KT_CALL_TESTER:
baseStatus = runtime.SP_context.getBaseStatus()
baseCallStatus = runtime.SP_context.getBaseCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO] and baseStatus == SP_Context.CONNECTED:
runtime.manager.stage.removeCallTest_CB()
elif runtime.manager.find_stage('VideoCallConnected'):
if status.KT_CALL_TESTER:
baseStatus = runtime.SP_context.getBaseStatus()
baseCallStatus = runtime.SP_context.getBaseCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO] and baseStatus == SP_Context.CONNECTED:
runtime.manager.stage.removeCallTest_CB()
if runtime.manager.find_stage('AudioCallConnected'):
if config.roxia_event:
print 'VDCIAPP : VideoCallConnected==> AudioCallConnected'
import model
#runtime.manager.back_stage('AudioCallConnected')
runtime.manager.change_stage(model.AudioCallConnectedStage)
else:
if config.roxia_event:
print 'VDCIAPP : VideoCallConnected'
import model
#runtime.manager.back_stage('VideoCallConnected')
runtime.manager.change_stage(model.VideoCallConnectedStage(False))
# KA: [20080520] wireless lan error check
runtime.manager.rtp_check()
# KA: [20080520] wireless lan error check ==
################# MESG_SERVER_HOLD ##################
elif _event == config.MESG_SERVER_HOLD:
import time
time.sleep(1)
#Roxia Begin jhbang 06.02.01
#if _mesg1=='2' and status.audio_mute == 1:
# runtime.vdciapp.send_mesg(code1=config.MESG_SET_PARAMS, \
# code2=config.MESG_SET_AUDIO_MUTE, \
# mesg1=status.audio_mute, chan1=int(_chan1))
#Roxia End jhbang
# KA: [20071126] DTMF nego
if status.get_current_channel() == int(_chan1):
status.set_dtmf_type(int(_mesg5))
elif status.get_inactive_channel() == int(_chan1):
status.toggle_active_call()
status.set_current_call_status()
status.set_dtmf_type(int(_mesg5))
status.toggle_active_call()
status.set_current_call_status()
# KA: [20071126] DTMF nego ==
if runtime.manager.stage.get_name() == 'HandsFreeNotify':
runtime.manager.back_stage()
elif runtime.manager.stage.get_name() == 'DisconnectNotify':
runtime.manager.back_stage()
elif runtime.manager.stage.get_name() == 'IncomingDisconnected':
runtime.manager.stage.next()
if runtime.manager.stage.get_name() == 'OptionsIP':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'CallHold':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'SecondCallConnecting':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'TwoCallOneHold':
if status.business_option_status == status.CallHoldOption:
runtime.manager.stage.alternate_call()
else:
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'SecondIncomingCall':
if status.business_option_status == status.CallHoldOption:
runtime.manager.stage.release_hold_successed()
else:
runtime.manager.stage.hold_call_sucessed()
elif runtime.manager.stage.get_name() == 'ReleaseHoldBackToConnected':
pass
elif runtime.manager.stage.get_name() == 'AudioCallConnected':
pass
elif runtime.manager.stage.get_name() == 'ItemOption':
runtime.manager.stage.invite_sucessed()
elif runtime.manager.stage.get_name() == 'dial list detail':
runtime.manager.stage.invite_sucessed()
# hcryoo : [20070502_1]
elif runtime.manager.stage.get_name() == 'CallConference':
runtime.manager.stage.make_conference()
# hcryoo : [20070502_1]==
elif runtime.manager.stage.get_name() == 'ErrorResultNotify':
pass
################# MESG_SERVER_HELD ##################
# 잠정적으로 고객 체험단에서 발생한 문제를 해결하기 위해 삭제함.
elif _event == config.MESG_SERVER_HELD :
pass
################# MESG_SERVER_RING ##################
elif _event == config.MESG_SERVER_RINGING:
MD.mmiTrace('proc_server_mesg_ex:MESG_SERVER_RINGING, stage=', runtime.manager.stage.get_name())
if _mesg1 == '0': # stop ring
# ringback 시에 소리가 불규칙한 문제점 해결.
runtime.SP_context.SP_setMicEnable()
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if dectStatus == DectCallManager.RINGBACK:
runtime.SP_context.stopTonePlay(SP_State.DEVICE_HSS1_TS1)
elif baseStatus == SP_Context.RINGBACK:
devices = runtime.SP_context.getCurrentDevice()
for device in devices:
if device == SP_State.DEVICE_HS:
runtime.SP_context.stopTonePlay(SP_State.DEVICE_HS)
else:
runtime.SP_context.stopTonePlay(SP_State.DEVICE_SPK)
elif dectStatus == DectCallManager.RINGING:
pass
elif baseStatus == SP_Context.RINGING:
pass
if runtime.manager.stage.get_name() == 'AudioCallConnected':
status.showSoftkeyFlag = True
runtime.manager.stage.changeMessagePrefix()
#KA: [20080515] call menu
#runtime.manager.stage.showSoftkey()
elif runtime.manager.stage.get_name() == 'VideoCallConnected':
status.showSoftkeyFlag = True
runtime.manager.stage.stopCallAnimation()
#runtime.manager.stage.changeMessagePrefix()
elif runtime.manager.stage.get_name() in ['directaudiocalling', 'directvideocalling']:
status.showSoftkeyFlag = True
elif _mesg1 == '2':
# KA: [20071126] DTMF nego
# dtmf update for network message
if status.get_current_channel() == int(_chan1):
status.set_dtmf_type(int(_mesg5))
elif status.get_inactive_channel() == int(_chan1):
status.toggle_active_call()
status.set_current_call_status()
status.set_dtmf_type(int(_mesg5))
status.toggle_active_call()
status.set_current_call_status()
# KA: [20071126] DTMF nego ==
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if dectStatus == DectCallManager.CONNECTING:
runtime.dectCallManager.setDectStatus(DectCallManager.RINGBACK)
status.set_video_mode(status.AudioConnected)
elif baseStatus == SP_Context.DIALING or baseStatus == SP_Context.RINGBACK:
runtime.SP_context.setBaseStatus(SP_Context.RINGBACK)
# hcryoo : [20071108_3] : 영상 링고 지원
if _mesg9 == '1':
runtime.vdciapp.send_mesg(code1=config.MESG_SET_PARAMS, \
code2=config.MESG_SET_DIMENSION, \
mesg1=config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_WQVGA, mesg2=0)
status.videocall_dimension = config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_WQVGA
import model
runtime.manager.change_stage(model.VideoCallConnectedStage,True)
runtime.SP_context.setPhysicalDevice()
runtime.manager.stage.stopCallAnimation()
# ringo가 없는 상황에서 테스트를 해 봐야 함.
#runtime.manager.stage.changeMessagePrefix()
runtime.manager.stage.showVideoView()
elif _mesg9 == '0':
#runtime.manager.stage.setCurrentTime()
if status.firstCallType == 2:
status.isFirstCallTypeChanged = True
#KA:[20081111] QA10-11: 두라인을 삭제해도 되는지,,,
#import model
#runtime.manager.change_stage(model.AudioCallConnectedStage,True)
# hcryoo : [20071108_3] : 영상 링고 지원==
elif _mesg1 == '3' :
if runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading':
roxia_event('VDCIAPP remove_cancel_key\n')
runtime.manager.stage.remove_timer_cancel()
else: # _mesg1 = '1' : start ring
#runtime.mmedia.unload() -- KA: Media play중 dect 발신일 경우를 고려. 삭제!!
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if dectStatus == DectCallManager.DIALING or dectStatus == DectCallManager.CONNECTING:
runtime.dectCallManager.setDectStatus(DectCallManager.RINGBACK)
runtime.SP_context.dect1.setTone(config.PLAY_RINGBACK_TONE)
runtime.SP_context.startTonePlay(SP_State.DEVICE_HSS1_TS1)
elif baseStatus == SP_Context.DIALING:
runtime.SP_context.setBaseStatus(SP_Context.RINGBACK)
currentDevices = runtime.SP_context.getCurrentDevice()
if SP_State.DEVICE_SPK in currentDevices:
runtime.SP_context.speaker.setTone(config.PLAY_RINGBACK_TONE)
runtime.SP_context.startTonePlay(SP_State.DEVICE_SPK)
if SP_State.DEVICE_HS in currentDevices:
runtime.SP_context.handset.setTone(config.PLAY_RINGBACK_TONE)
runtime.SP_context.startTonePlay(SP_State.DEVICE_HS)
# startTonePlay()로 한 번에 하면 dect의 busy tone play에 영향을 준다.
if runtime.manager.stage.get_name() == 'VideoCallConnecting': # vpark changed audio to video
runtime.manager.stage.stop_wait_invite_timer()
elif runtime.manager.stage.get_name() == 'SecondCallConnecting':
if status.business_option_status == status.BlindTransferOption:
status.business_option_status = status.CallTransferOption
################# MESG_SERVER_HANGUP ##################
elif _event == config.MESG_SERVER_HANGUP:
MD.mmiTrace('proc_server_mesg_ex:MESG_SERVER_HANGUP, stage=', runtime.manager.stage.get_name())
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if not status.trapChecked:
status.trapChecked = True
setting.dropCall = setting.dropCall + 1
runtime.mmiDebug.mmiTrace('VDCIApp::MESG_SERVER_HANGUP / setting.dropCall = ', setting.dropCall)
# **************************************************** 좀 더 생각해 보자.
if dectStatus == DectCallManager.CONNECTED:
ts1OnHook = runtime.SP_context.TS1_OnHook()
if ts1OnHook.next():
ts1OnHook.next()
# 상대측에서 종료하여서 무조건 IDLE 로 보낸다. ==> 추후 조정이 필요함.
runtime.SP_context.goIdleState()
# 임시 --> 최종적으로 idle에서 동작하도록 함.
runtime.SP_context.clearWidebandCodecFlag()
if baseStatus == SP_Context.TRANSFER_RINGING:
if runtime.manager.stage.get_name() == 'H2B_Transfer':
runtime.manager.stage.transferCancelledByBase()
runtime.manager.back_stage()
else:
runtime.manager.stage.H2b_transferCancelledByBase()
elif dectStatus == DectCallManager.TRANSFER_RINGING:
if runtime.manager.stage.get_name() == 'B2H_Transfer':
runtime.manager.stage.transferCancelledByBase() # cancel
runtime.manager.back_stage()
else:
runtime.manager.stage.B2h_transferCancelledByBase()
if dectStatus == DectCallManager.CONNECTED:
# hcryoo : [080730] : 영상호에서 전환한 후 다시 덱트간 전환 시에 상대방이 종료하는 경우 발생하는 오류 수정
if runtime.manager.find_stage('VideoCallConnected', True):
runtime.dectCallManager.rejectCallByBase()
self.end_call()
else:
runtime.dectCallManager.serverStopCall()
# hcryoo : [080730] : 영상호에서 전환한 후 다시 덱트간 전환 시에 상대방이 종료하는 경우 발생하는 오류 수정==
runtime.SP_context.setInSession(False)
# [20080923_1] : hcryoo : [QA 7-18] 덱트 사용 중 화면이 덱트 종료 후 변경되지 않음.
if runtime.manager.stage.get_name() == 'InUseByDect':
devices = runtime.SP_context.getCurrentDevice()
for device in devices:
if device == SP_State.DEVICE_HS:
hsOnHook = runtime.SP_context.HS_OnHook()
if hsOnHook.next():
hsOnHook.next()
elif device == SP_State.DEVICE_SPK:
spkOnHook = runtime.SP_context.SPK_OnHook()
if spkOnHook.next():
spkOnHook.next()
spkOnHook.next()
runtime.manager.back_stage()
# [20080923_1] : hcryoo : [QA 7-18] 덱트 사용 중 화면이 덱트 종료 후 변경되지 않음.==
return
else:
self.end_call()
################# MESG_SERVER_VIDEO_PROCEEDING ##################
elif _event == config.MESG_SERVER_VIDEO_PROCEEDING :
roxia_event('VDCI_APP MESG_SERVER_VIDEO_PROCEEDING show cancel key')
# hcryoo : [20070509_2]
if runtime.manager.stage.get_name() == 'VideoCallRequestForCallTrading':
runtime.manager.stage.activate_cancel_key()
return
# hcryoo : [20070509_2]==
pass
# [20080901_1]: hcryoo : [KT] 통화 중 화면 오류건
# ######################MESG_SERVER_DTMF#########################
# [20080901_1]: hcryoo : [KT] 통화 중 화면 오류건==
################# MESG_SERVER_VIDEO_REQUESTED ##################
elif _event == config.MESG_SERVER_VIDEO_REQUESTED: # dtmf received
MD.mmiTrace('MESG_SERVER_VIDEO_REQUESTED, stage=', runtime.manager.stage.get_name())
MD.mmiTrace('status.video_mode =', status.video_mode)
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if status.video_mode == status.AudioConnected:
if _mesg1 == '1': # 음성 호 중에 call trade up 이 발생한 경우 /현재는 항상 1(video)이 들어온다.
# 음성 호가 연결된 후에 영상 광고가 들어오면 받아 주고 그 외 call trade up은 reject한다.
# dect가 사용 중인 경우는 영상 광고를 받지 않는다.
if _mesg4 == '5' and dectStatus == DectCallManager.IDLE:
MD.mmiTrace( '1111111111111111111111111111111111')
status.pushVideoAd = True
if runtime.manager.stage.get_name() == 'VideoCallConnected' or runtime.manager.stage.get_name() == 'AudioCallConnected':
runtime.manager.stage.stopCallDuration()
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL)
else:
if status.firstCallType:
if status.firstCallType == 1: # audio
MD.mmiTrace( '2222222222222222222222222')
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL, mesg3=config.MESG_INDIRECT_VIDEO_REJECT)
else: # video
MD.mmiTrace( '333333333333333333333333333')
if status.isFirstCallTypeChanged:
MD.mmiTrace( '333333333333333333333333333---1111111111111111')
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL, mesg3=config.MESG_INDIRECT_VIDEO_REJECT)
else:
MD.mmiTrace( '333333333333333333333333333------------222222222')
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL)
else: # 음성 호를 DECT가 받는 경우
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL, mesg3=config.MESG_INDIRECT_VIDEO_REJECT)
elif status.video_mode == status.VideoConnected:
if _mesg1 == '1':
MD.mmiTrace( '444444444444444444444444444444')
MD.mmiTrace('status.pushVideoAd = ', status.pushVideoAd)
if status.pushVideoAd and baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO]:
MD.mmiTrace( '55555555555555555555555')
if _mesg4 == '5' and dectStatus == DectCallManager.IDLE:
MD.mmiTrace( '66666666666666666666')
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL)
else:
MD.mmiTrace( '77777777777777777777')
if runtime.dectCallManager.isSubcribedDect() and baseCallStatus == SP_Context.IDLE and dectStatus != DectCallManager.IDLE:
callerNumber = status.display_caller_number(status.active_call_index)
callerName = status.display_caller_name(status.active_call_index)
runtime.dectCallManager.sendCidType2(callerName, callerNumber)
if status.serviceStatusType in ['BW', 'WB'] and status.firstCallType == 2:
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL)
status.pushVideoAd = False
else:
runtime.manager.stage.stopCallDuration()
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL, mesg3=config.MESG_INDIRECT_VIDEO_REJECT)
else: # 일반 비디오 호 상태
MD.mmiTrace( '88888888888888888888888')
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL)
# KA: [20080722]
#if not status.second_info_accept:
# print 'ka....############## 8 SECOND second_info_accept', status.second_info_accept, status.second_info_number
# if status.second_info_number:
# import calldb, ntptime
# calldb.add_call_log('missed', status.second_info_number, 0, 0, \
# status.second_info_time, ntptime.ntime() - status.second_info_time)
# status.second_info_number = ''
# status.second_info_time = 0
#else:
# print 'ka....############## 9 SECOND second_info_accept', status.second_info_accept, status.second_info_number
# # 수락한 경우에는 S|CS받고 정상 종료하는 경우에 로그를 남긴다.??
# pass
# KA: [20080722] ==
else:
MD.mmiTrace( '9999999999999999999999999999999')
# transfering이 경우는 ?
if runtime.dectCallManager.isSubcribedDect() and dectStatus == DectCallManager.CONNECTED:
runtime.vdci_send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_ACCEPT, \
chan1=int(_chan1), mesg1=config.NOT_SUPERVISION_CALL, mesg3=config.MESG_INDIRECT_VIDEO_REJECT)
elif _event == config.MESG_SERVER_MESSAGE:
if runtime.dectHandler.isDectSendingSms():
runtime.dectCallManager.sendSmsSendResultToDect(int(_mesg1), _mesg2)
else:
# shchun: should remove file in _mesg4, gun requested
#runtime.vmHandler.VM_SMMS_SEND_RESULT(_mesg1, _mesg2)
cmd = 'rm -f %s'%_mesg4
debugLogC('Remove sms data from path', cmd)
os.system(cmd)
elif _event == config.MESG_SERVER_MMS:
roxia_trace('MESG_SERVER_MMS, stage=', runtime.manager.stage.get_name())
import mms_net_define
if _mesg2 in (mms_net_define.SMS_BUDDY, mms_net_define.SMS_BUDDY):
from smtp import SmsSipHandler
smsSipHandler = SmsSipHandler(_mesg1, _mesg2, _mesg3, _mesg4)
smsSipHandler.printVar(1)
if _mesg3 == mms_net_define.M_SEND_CONF:
if runtime.manager.stage.get_name() == 'sendMessage':
runtime.manager.stage.analyseConf(smsSipHandler)
if _mesg3 == mms_net_define.M_NOTIFICATION_IND:
runtime.manager.handle_M_Notification_Ind(smsSipHandler)
elif _event == config.MESG_SERVER_KT_MESSAGE:
roxia_trace('MESG_SERVER_KT_MESSAGE::KT-IMS SMS/MMS')
#if status.isSmsProcessing:
# self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_MSG_REJECT, chan1=int(_chan1), mesg1=config.REASON_BUSY_HERE)
# return
if (_mesg2 == 'text/plain' or _mesg2 == 'text/xml') and runtime.dectCallManager.isSubcribedDect():
status.isSmsProcessing = True
def clearTempMessagingTimer():
status.tempMessagingTimer = None
if status.TEMP_MSG_CONDITION:
import utils
status.tempMessagingTimer = utils.Timer(300*1000, clearTempMessagingTimer)
if runtime.eaHandler.isAppInUse() or status.video_mode != status.VideoIdle:
runtime.vmHandler.keepMMSMessage(int(_chan1), '1', _mesg1, _mesg2, _mesg3, _mesg4, _mesg6)
else:
runtime.vmHandler.keepMMSMessage(int(_chan1), '0', _mesg1, _mesg2, _mesg3, _mesg4, _mesg6)
if status.TEMP_MSG_CONDITION:
runtime.vdciapp.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_MSG_REJECT, chan1=int(_chan1), mesg1='200')
runtime.vmHandler.sendMessageWithDectConfirm()
baseStatus, toAddress, contentType, subject, filePath, replyUser = runtime.vmHandler.getMMSInfoForMessageTest()
runtime.dectCallManager.receiveSmsFromIsmc(int(_chan1), toAddress, contentType, subject, filePath, replyUser)
else:
runtime.dectCallManager.receiveSmsFromIsmc(int(_chan1), _mesg1, _mesg2, _mesg3, _mesg4, _mesg6)
else: # base SMS and MMS
import time
time.sleep(0.1)
# SMS 인 경우에만 200 처리 / MMS 인 경우에는 하부단에서 처리된다고 함.
if _mesg2 == 'text/plain' or _mesg2 == 'text/xml':
runtime.vdciapp.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_MSG_REJECT, chan1=int(_chan1), mesg1='200')
if runtime.eaHandler.isAppInUse() or status.video_mode != status.VideoIdle:
runtime.vmHandler.VM_SMMS_RECV_REQUEST('1', _mesg1, _mesg2, _mesg3, _mesg4, _mesg6)
else:
runtime.vmHandler.VM_SMMS_RECV_REQUEST('0', _mesg1, _mesg2, _mesg3, _mesg4, _mesg6)
# KA: [20071105] TI IMS subscriber
################# MESG_SERVER_SUBSCRIBER ##################
# success
elif _event == config.MESG_SERVER_SUBSCRIBER:
debugLogN('SUBSCRIBE: OK')
# KA: [20080420] new register
self.subscriber_timer = None
self.retry_subscriber_count = 0
self.subscriber_success = True
# KA: [20080420] new register ==
if runtime.manager.stage.get_name() == 'Subscription':
runtime.manager.stage.subscriber_sucessed()
'''
runtime.mmiDebug.mmiTrace('임시로 등록을 한다.')
from dectHandler import DectCallManager
if runtime.dectCallManager.isSubcribedDect() and status.get_register_mode() == status.Registered:
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_SUCCESS)
'''
elif _event == config.MESG_SERVER_DE_SUBSCRIBER:
debugLogN('DESUBSCRIBE: OK')
self.subscriber_success = False
if runtime.manager.stage.get_name() == 'ReleaseSubscription' or \
runtime.manager.stage.get_name() == 'autoregistering':
runtime.manager.stage.desubscriber_sucessed()
elif _event == config.MESG_SERVER_SUBSCRIBER_FAIL:
if _mesg3 in ('7', '8', '9'):
runtime.dectCallManager.sendRegistrationReport(DectCallManager.REG_FAILURE, True)
debugLogN('SUBSCRIBE-display phone status')
message= errorcode.msg_SR480
errorcode.set_idle_errmsg(errmsg=message, refresh=True)
self.set_register_status(False)
elif _mesg3 == '6':
runtime.dectCallManager.sendRegistrationReport(DectCallManager.REG_START, True)
debugLogN('SUBSCRIBE-display phone status')
message= errorcode.msg_SR103
errorcode.set_idle_errmsg(errmsg=message, refresh=True)
# KA: [20071105] TI IMS subscriber ==
elif _event == config.MESG_SERVER_SESSION_OK:
runtime.SP_context.setInSession(True)
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO]:
if baseStatus == SP_Context.RINGBACK:
runtime.SP_context.setBaseStatus(SP_Context.CONNECTED)
elif baseCallStatus in [SP_Context.INCOMING_AUDIO, SP_Context.INCOMING_VIDEO]:
if baseStatus == SP_Context.RINGING:
runtime.SP_context.setBaseStatus(SP_Context.CONNECTED)
if runtime.dectCallManager.isSubcribedDect():
'''
if dectCallStatus in [DectCallManager.OUTGOING_AUDIO, DectCallManager.OUTGOING_VIDEO]:
if dectStatus == DectCallManager.RINGBACK:
runtime.dectCallManager.setDectStatus(DectCallManager.CONNECTED)
elif dectCallStatus in [DectCallManager.INCOMING_AUDIO, DectCallManager.INCOMING_VIDEO]:
'''
if dectCallStatus in [DectCallManager.INCOMING_AUDIO, DectCallManager.INCOMING_VIDEO]:
if dectStatus == DectCallManager.RINGING:
runtime.dectCallManager.setDectStatus(DectCallManager.CONNECTED)
runtime.SP_context.setPhysicalDevice()
elif _event == config.MESG_CALL_INFO:
# 임시로 보냄.--> 추후 삭제되어야 함.
runtime.vdci_send_mesg(code1='p', code2='g', chan1=int(_chan1))
MD.mmiTrace('_mesg1 = ', _mesg1)
MD.mmiTrace('_mesg2 = ', _mesg2)
firstCallNumber = None
firstCallStatus = None
secondCallNumber = None
secondCallStatus = None
if _mesg1:
firstCallNumber, firstCallStatus = _mesg1.split(':')
if _mesg2:
secondCallNumber, secondCallStatus = _mesg2.split(':')
if firstCallNumber:
if firstCallNumber[0:4] == '*010':
firstCallNumber = firstCallNumber[1:]
if secondCallNumber:
if secondCallNumber[0:4] == '*010':
secondCallNumber = secondCallNumber[1:]
MD.mmiTrace('firstCallNumber = ', firstCallNumber)
MD.mmiTrace('firstCallStatus = ', firstCallStatus)
MD.mmiTrace('secondCallNumber = ', secondCallNumber)
MD.mmiTrace('secondCallStatus = ', secondCallStatus)
# second call 정보를 다시 한번 update해준다.
'''
if firstCallNumber and secondCallNumber:
if status.second_info_number == 'anonymous':
print 'ka...##### change second caller number=', status.second_info_number, secondCallNumber
status.second_info_number = secondCallNumber
'''
print 'status.video_mode = ', status.video_mode
'''
currentStage = runtime.manager.stage.get_name()
if not currentStage in ['AudioCallConnected', 'VideoCallConnected']:
if currentStage == 'AudioCallConnected':
runtime.manager.back_stage('AudioCallConnected')
elif currentStage == 'VideoCallConnected':
runtime.manager.back_stage('VideoCallConnected')
'''
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
#if dectStatus != DectCallManager.IDLE and status.video_mode in [status.VideoConnected, status.AudioConnected]:
if baseCallStatus == SP_Context.IDLE and dectCallStatus in [SP_Context.INCOMING_AUDIO, SP_Context.OUTGOING_AUDIO] and dectStatus == DectCallManager.CONNECTED:
if firstCallStatus == self.RINGING:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'RR'
elif secondCallStatus == self.BUSY:
status.serviceStatusType = 'RB'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'RW'
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'RU'
elif firstCallStatus == self.BUSY:
if secondCallStatus == self.RINGING:
MD.mmiTrace('BUSY / RINGING')
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
status.serviceStatusType = 'BR'
# S|W의 second call 처리에서 time start함.
# INFO 처리
#runtime.manager.stage.showSecondCallNumber(secondCallNumber)
elif secondCallStatus == self.BUSY:
# 3 자 통화
MD.mmiTrace('BUSY / BUSY')
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if not status.serviceStatusType in ['BB', 'BW', 'WB']:
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
status.serviceStatusType = 'BB'
#runtime.manager.stage.showThreeWayConference(firstCallNumber, secondCallNumber)
status.info_status = True
elif secondCallStatus == self.WAITING:
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'BW'
#runtime.manager.stage.clearSecondCallNumberTimer()
#runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, False)
status.info_status = True
elif status.serviceStatusType in ['BR', 'RB', 'WB', 'BW']:
status.serviceStatusType = 'BW'
#runtime.manager.stage.clearSecondCallNumberTimer()
#runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, True)
status.info_status = True
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'BU'
else:
MD.mmiTrace('BUSY / NONE')
if status.serviceStatusType in ['BB']:
status.serviceStatusType = 'BN'
#runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BR', 'RB']:
status.serviceStatusType = 'BN'
#runtime.manager.stage.checkAndRemoveSecondCallNumber()
#runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('missed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('missed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('missed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('missed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BW', 'WB']:
status.serviceStatusType = 'BN'
#runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if status.isConferenceCall == True:
if firstCallNumber == status.first_info_number:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
status.isConferenceCall = False
else:
if firstCallNumber == status.first_info_number:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'BN'
#runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
else:
status.serviceStatusType = 'BN'
if runtime.manager.stage.get_name() != 'idle':
runtime.manager.stage.changeCallerInfo(firstCallNumber)
elif firstCallStatus == self.WAITING:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'WR'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
status.isConferenceCall = True
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
elif secondCallStatus == self.BUSY:
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'WB'
#runtime.manager.stage.clearSecondCallNumberTimer()
#runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, False)
status.info_status = True
elif status.serviceStatusType in ['BR', 'RB']:
status.serviceStatusType = 'WB'
#runtime.manager.stage.clearSecondCallNumberTimer()
#runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, True)
status.info_status = True
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'WW'
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'WU'
else:
status.serviceStatusType = 'WN'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif firstCallStatus == self.UNKNOWN:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'UR'
elif secondCallStatus == self.BUSY:
status.serviceStatusType = 'UB'
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'UW'
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'UU'
else:
if runtime.manager.find_stage('VideoCallConnected'):
runtime.manager.back_stage('VideoCallConnected')
elif runtime.manager.find_stage('AudioCallConnected'):
runtime.manager.back_stage('AudioCallConnected')
print 'STAGE = ', runtime.manager.stage.get_name()
if firstCallStatus == self.RINGING:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'RR'
elif secondCallStatus == self.BUSY:
status.serviceStatusType = 'RB'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'RW'
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'RU'
elif firstCallStatus == self.BUSY:
if secondCallStatus == self.RINGING:
MD.mmiTrace('BUSY / RINGING')
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
status.serviceStatusType = 'BR'
# S|W의 second call 처리에서 time start함.
# INFO 처리
#runtime.manager.stage.showSecondCallNumber(secondCallNumber)
elif secondCallStatus == self.BUSY:
# 3 자 통화
MD.mmiTrace('BUSY / BUSY')
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if not status.serviceStatusType in ['BB', 'BW', 'WB']:
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
status.serviceStatusType = 'BB'
runtime.manager.stage.showThreeWayConference(firstCallNumber, secondCallNumber)
status.info_status = True
elif secondCallStatus == self.WAITING:
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'BW'
runtime.manager.stage.clearSecondCallNumberTimer()
runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, False)
status.info_status = True
elif status.serviceStatusType in ['BR', 'RB', 'WB', 'BW']:
status.serviceStatusType = 'BW'
runtime.manager.stage.clearSecondCallNumberTimer()
runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, True)
status.info_status = True
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'BU'
else:
MD.mmiTrace('BUSY / NONE')
if status.serviceStatusType in ['BB']:
status.serviceStatusType = 'BN'
runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BR', 'RB']:
status.serviceStatusType = 'BN'
runtime.manager.stage.checkAndRemoveSecondCallNumber()
runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('missed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('missed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('missed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('missed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['BW', 'WB']:
status.serviceStatusType = 'BN'
runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if status.isConferenceCall == True:
if firstCallNumber == status.first_info_number:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
status.isConferenceCall = False
else:
if firstCallNumber == status.first_info_number:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('received', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.video_mode == status.AudioConnected:
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
if status.second_info_call_mode == 0: # audio
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else:
import calldb, ntptime
calldb.add_call_log('received', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
elif status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'BN'
#runtime.manager.stage.changeCallerInfo(firstCallNumber, changeMessage=True)
if firstCallNumber == status.first_info_number:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.second_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.second_info_number = ''
status.second_info_call_duration_start = 0
else:
if status.firstCallType == 1: # audio
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start, 0, 0)
else: # video
import calldb, ntptime
calldb.add_call_log('dialed', status.first_info_number ,\
0, 0, status.second_info_call_duration_start, ntptime.ntime() - status.second_info_call_duration_start)
status.first_info_number = ''
status.second_info_call_duration_start = 0
else:
status.serviceStatusType = 'BN'
runtime.manager.stage.changeCallerInfo(firstCallNumber)
elif firstCallStatus == self.WAITING:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'WR'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
status.isConferenceCall = True
import ntptime
status.second_info_call_duration_start = ntptime.ntime()
elif secondCallStatus == self.BUSY:
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
if status.serviceStatusType in ['WR', 'RW']:
status.serviceStatusType = 'WB'
runtime.manager.stage.clearSecondCallNumberTimer()
runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, False)
status.info_status = True
elif status.serviceStatusType in ['BR', 'RB']:
status.serviceStatusType = 'WB'
runtime.manager.stage.clearSecondCallNumberTimer()
runtime.manager.stage.showCallWaiting(firstCallNumber, secondCallNumber, True)
status.info_status = True
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'WW'
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'WU'
else:
status.serviceStatusType = 'WN'
status.first_info_number = firstCallNumber
status.second_info_number = secondCallNumber
elif firstCallStatus == self.UNKNOWN:
if secondCallStatus == self.RINGING:
status.serviceStatusType = 'UR'
elif secondCallStatus == self.BUSY:
status.serviceStatusType = 'UB'
elif secondCallStatus == self.WAITING:
status.serviceStatusType = 'UW'
elif secondCallStatus == self.UNKNOWN:
status.serviceStatusType = 'UU'
################# SERVER EVENT: ERROR ##################
elif _result == config.MESG_SERVER_ERROR: # Server message: abnormal
if _event == config.MESG_SERVER_REGISTER:
debugLogN('REG-ERR: mesg1(%s)'%_mesg1)
# KA: [20080420] new register
if _mesg1 == '504' or _mesg6 == '1': # fail count
pass
else:
return
# KA: [20080420] new register ==
'''
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
from dectHandler import DectCallManager
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
'''
# KA: [20080503] new register error code
msg = errorcode.ErrorCode(_mesg1)
# KA: [20080503] new register error code ==
self.set_register_status(False)
if _mesg1 == '403':
runtime.dectCallManager.unregisterstatusReport2()
runtime.dectCallManager.sendRegistrationStatusReportToDect(MessageCode.REG_MESSAGE.FORBIDDEN_403)
elif _mesg1 == '404' or _mesg1 == '410':
runtime.dectCallManager.unregisterstatusReport2()
runtime.dectCallManager.sendRegistrationStatusReportToDect(MessageCode.REG_MESSAGE.NOT_FOUND_404_410)
# invite timeout
#if _mesg1 == '504':
# if status.video_mode != status.VideoIdle:
# debugLogN('skip: reg-ping check, in call')
# return
#runtime.manager.stage.get_name() == 'autoregistering' or \
if runtime.manager.stage.get_name() == 'deregistering' or \
runtime.manager.stage.get_name() == 'autoderegistering' or \
runtime.manager.stage.get_name() == 'DeRegistering':
runtime.manager.stage.deregister_sucessed()
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
elif runtime.manager.stage.get_name() == 'registering' or \
runtime.manager.stage.get_name() == 'configregistering' or \
runtime.manager.stage.get_name() == 'config autoregistering' or \
runtime.manager.stage.get_name() == 'autoregistering' or \
runtime.manager.stage.get_name() == 'idleregistering':
# invite timeout
if _mesg1 == '504' and _mesg6 == '0':# and status.video_mode != status.VideoIdle: #debugLogC('skip: reg-ping check, in call')
if status.dnsPingCount:
return True
def success_cb():
# when ping success redundency can be ok
#runtime.manager.stage.register_failed(msg)
pass
def fail_cb():
runtime.manager.do_netchk_fail_cb()
try:
runtime.manager.stage.register_failed(msg)
except:
print 'pass register_failed()'
pass
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
# shchun : add ping test when reg_fail
debugLogN('c')
runtime.manager.ICMP_request(success_cb, fail_cb)
return
elif _mesg1 == '504' and _mesg6 == '1':
status.dnsPingCount = False
runtime.manager.stage.register_failed(msg)
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
else:
runtime.manager.stage.register_failed(msg)
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
else:
# 일반적인 invite fail의 경우에도 ping체크 한다.
if _mesg1 == '504' and _mesg6 == '0':
if status.dnsPingCount:
return True
def success_cb():
# when ping success redundency can be ok
#runtime.manager.stage.register_failed(msg)
pass
def fail_cb():
runtime.manager.do_netchk_fail_cb_504()
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
# shchun : add ping test when reg_fail
debugLogN('reg-ping check - 504')
runtime.manager.ICMP_request(success_cb, fail_cb)
return
elif _mesg1 == '504' and _mesg6 == '1':
status.dnsPingCount = False
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
else:
if runtime.dectCallManager.isSubcribedDect() and not status.DECT_PATH_TEST:
runtime.mmiDebug.mmiTrace('재 등록 실패 시에는 DECT로 알리지 않는다.')
runtime.dectCallManager.sendRegistrationResultReport(DectCallManager.REG_FAILURE)
runtime.dectCallManager.unregisterstatusReport()
############ De-regi report는 아래에서 처리하도록 한다. ######################
runtime.vmHandler.ERR_SIP_UNREGISTERED()
# KA: [20080414] dect base reset 시 BASE의 상태를 알려주기 위해
#registraion fail
runtime.manager.set_registerinfo('1')
errorcode.set_idle_errmsg(msg)
from trapManager import TrapHandler
reasonCode = int(_mesg1)
runtime.trapHandler.sendSipRegisterTrap(TrapHandler.REG_FAILURE, reasonCode)
# E|C
elif _event == config.MESG_SERVER_CALL: # CALL.ERROR.
MD.mmiTrace('MESG_SERVER_CALL[=E|C]')
if _mesg1 == '504' and _mesg4 == '1':
debugLogN('504 Call error - disabled')
if status.video_mode != status.VideoIdle:
runtime.vdci_send_mesg(code1=config.MESG_HANGUP)
if runtime.eaHandler.getBankInUse():
return
if status.KT_CALL_TESTER:
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if baseCallStatus in [SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO] and baseStatus == SP_Context.CONNECTED:
runtime.manager.stage.removeCallTest_CB()
if not status.trapChecked:
status.trapChecked = True
setting.callSucc = setting.callSucc + 1
runtime.mmiDebug.mmiTrace('VDCIApp: E|C: setting.callSucc = ', setting.callSucc)
# set calll Info trap data
MD.mmiTrace('status.sipResponseCodeForTrap(BEFORE) = ', _mesg1)
if _mesg1:
status.sipResponseCodeForTrap = int(_mesg1)
else:
status.sipResponseCodeForTrap = 200
MD.mmiTrace('status.sipResponseCodeForTrap(AFTER) = ', status.sipResponseCodeForTrap)
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if runtime.dectCallManager.isSubcribedDect():
if baseStatus == SP_Context.IDLE and dectStatus != DectCallManager.IDLE:
status.set_video_mode(status.VideoIdle)
if dectStatus == DectCallManager.REJECT:
MD.mmiTrace('TEST CALL REJECT')
runtime.dectCallManager.rejectCall()
else:
if _mesg1 in [config.REASON_FORBIDDEN, config.REASON_NOT_ACCEPTABLE_406, \
config.REASON_BAD_EXTENSION, config.REASON_TEMPORARILY_UNAVAILABLE, \
config.REASON_NOT_ACCEPTABLE_HERE, config.REASON_NOT_ACCEPTABLE_606, \
config.REASON_BUSY_HERE, config.REASON_BUSY_EVERYWHERE, \
config.REASON_INTERNAL_SERVER_ERROR, config.REASON_SERVICE_UNAVAILABLE]:
runtime.dectCallManager.cancelCall(int(_mesg1))
else:
runtime.dectCallManager.cancelCall()
return
old_exiting = self.exiting
self.exiting = False
MD.mmiTrace('runtime.manager.stage.get_name() = ', runtime.manager.stage.get_name())
# check error code
if _mesg1 in [config.REASON_FORBIDDEN, config.REASON_NOT_ACCEPTABLE_406, \
config.REASON_BAD_EXTENSION, config.REASON_TEMPORARILY_UNAVAILABLE, \
config.REASON_NOT_ACCEPTABLE_HERE, config.REASON_NOT_ACCEPTABLE_606]:
with_error='cg'
elif _mesg1 in [config.REASON_BUSY_HERE, config.REASON_BUSY_EVERYWHERE]:
with_error='busy'
elif _mesg1 in [config.REASON_INTERNAL_SERVER_ERROR, config.REASON_SERVICE_UNAVAILABLE]:
with_error='server_error'
else:
with_error=False
baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
if runtime.manager.stage.get_name() == 'directvideocalling':
runtime.manager.stop_video_call(with_error)
elif runtime.manager.stage.get_name() == 'directaudiocalling' :
runtime.manager.stop_audio_call(with_error)
# [20080504_9]: hcryoo: 호 통화 관련 오류 메시지==
elif runtime.manager.stage.get_name() == 'incomingcall' or runtime.eaHandler.pauseTimer:
# KA: pauseTimer check added - VM사용중 incoming와서 waitPause하는 중에 E|C가 올라오는 경우
if runtime.eaHandler.pauseTimer:
runtime.eaHandler.rcvPauseAck(callError=True)
# idle로 가지 않아 여기서 베이스 상태를 dect에 보냄
if runtime.dectCallManager.isSubcribedDect() and dectStatus != DectCallManager.IDLE:
runtime.dectCallManager.rejectCallByBase()
runtime.manager.kill_ringer()
runtime.manager.handle_missing_call()
runtime.dectCallManager.sendVideophoneStatusReportToDect(MessageCode.VP_STATUS.IDLE)
elif runtime.manager.stage.get_name() == 'callconnecting':
runtime.manager.back_stage(isshow=False)
self.end_call()
# 덱트로 수신함과 동시에 발신자가 종료한 경우를 막는 것. [링고가 없는 RINGING 의 경우 처리 필요 !]
elif runtime.manager.stage.get_name() == 'idle' and dectStatus == DectCallManager.CONNECTED:
status.setClearCallStatus()
status.set_video_mode(status.VideoIdle)
else:
# E|C의 경우에는 무시??
# Stages는 Connected 이지만 실제 호는 연결되지 않은 경우 (링고 수신)
#from mmiSoundPath import SP_Context
#baseCallStatus, baseStatus, dectCallStatus, dectStatus = status.getCurrentCallStatus()
#print 'ka...### E|C.....', baseCallStatus, baseStatus, dectCallStatus, dectStatus
if baseCallStatus in (SP_Context.OUTGOING_AUDIO, SP_Context.OUTGOING_VIDEO) and \
baseStatus == SP_Context.CONNECTED:
if baseCallStatus == SP_Context.OUTGOING_AUDIO:
runtime.manager.stop_audio_call(with_error)
elif baseCallStatus == SP_Context.OUTGOING_VIDEO:
runtime.manager.stop_video_call(with_error)
else:
self.end_call()
return True
if _mesg1 in [config.REASON_FORBIDDEN, config.REASON_NOT_ACCEPTABLE_406, \
config.REASON_BAD_EXTENSION, config.REASON_TEMPORARILY_UNAVAILABLE, \
config.REASON_NOT_ACCEPTABLE_HERE, config.REASON_NOT_ACCEPTABLE_606]:
self.end_call(with_error='cg')
elif _mesg1 in [config.REASON_BUSY_HERE, config.REASON_BUSY_EVERYWHERE]:
self.end_call(with_error='busy')
elif _mesg1 in [config.REASON_INTERNAL_SERVER_ERROR, config.REASON_SERVICE_UNAVAILABLE]:
self.end_call(with_error='server_error')
else:
# dect 발신인 경우 base는 변화 없음(outgoing timeout)
#if baseStatus == SP_Context.IDLE:
# pass
#else:
#self.end_call()
pass
elif _event == config.MESG_SERVER_TRANSFER:
if runtime.manager.stage.get_name() == 'HandsFreeNotify':
runtime.manager.back_stage()
runtime.manager.stage.transfer_fail()
elif _event == config.MESG_SERVER_DTMF: # dtmf received (with error)
pass
elif _event == config.MESG_SERVER_KILLED:
if profile.ip_mode == 1:
import phonesetting
phonesetting.vdci_reload()
if status.video_mode == status.VideoConnected or \
status.video_mode == status.AudioConnected:
self.with_error = True
if not self.hangup_timer: # overlap check
import utils
if config.videocall_debug: print '08.21 MESG_HANGUP 11 - not hangup_timer'
self.hangup_timer = utils.Timer(3000, self.end_call )
elif _event == config.MESG_SERVER_MESSAGE:
if runtime.dectHandler.isDectSendingSms():
runtime.dectCallManager.sendSmsSendResultToDect(int(_mesg1), _mesg2)
else:
runtime.vmHandler.VM_SMMS_SEND_RESULT(_mesg1, _mesg2)
if _mesg1 == '504':
debugLogC('504 Message error')
runtime.manager.do_network_check()
# KA: [20071105] TI IMS Subscriber
elif _event == config.MESG_SERVER_SUBSCRIBER:
debugLogN('SUBSCRIBER-ERR: subscriber_fail(%d)'%self.subscriber_success)
self.subscriber_success = False
if _mesg6:
self.subscriber_expire = _mesg6
self.req_subscriber()
if runtime.manager.stage.get_name() == 'Subscription':
runtime.manager.stage.subscriber_failed()
elif _event == config.MESG_SERVER_DE_SUBSCRIBER:
debugLogN('DESUBSCRIBER-ERR: subscriber_fail')
self.subscriber_success = False
if runtime.manager.stage.get_name() == 'ReleaseSubscription':
runtime.manager.stage.desubscriber_failed()
# KA: [20071105] TI IMS Subscriber ==
elif _event == config.MESG_SERVER_UPDATE_SUCC:
if _mesg1 == '504' and _mesg4 == '1':
if status.video_mode != status.VideoIdle:
runtime.vdci_send_mesg(code1=config.MESG_HANGUP)
elif _event == config.MESG_SERVER_SESSION:
if status.video_mode != status.VideoIdle:
runtime.vdci_send_mesg(code1=config.MESG_HANGUP)
return True
def destroy(self):
import signal
if self.run_recv_thread != None:
runtime.evas.input_remove(self.run_recv_thread)
self.run_recv_thread = None
try:
if self.vdciapp_pid:
os.kill(self.vdciapp_pid, signal.SIGKILL)
def clear_vdci():
try:
os.system( "killall -9 VDCIApp" )
os.waitpid(self.vdciapp_pid, 0)
self.vdciapp_pid = None
except OSError:
pass
return False
runtime.evas.timeout_add( 3000, clear_vdci )
except OSError:
pass
self.hangup_timer = None
def kill_vdciapp(self):
def killall(name, sig):
for pid in os.listdir('/proc'):
cmdline_path = '/proc/%s/cmdline' % pid
if os.path.exists(cmdline_path):
try:
pid = int(pid)
except ValueError:
continue
if open(cmdline_path).read().startswith(name):
os.kill(pid, sig)
if self.run_recv_thread != None:
runtime.evas.input_remove(self.run_recv_thread)
self.run_recv_thread = None
while 1:
if self.vdciapp_pid:
print 'vdci pid = ', self.vdciapp_pid
try:
import signal, time
os.kill(self.vdciapp_pid, signal.SIGTERM) #signal.SIGKILL
time.sleep(0.5)
os.kill(self.vdciapp_pid, signal.SIGKILL)
vwpid, vret = os.waitpid(self.vdciapp_pid, 0)
print 'vwpid = ', vwpid
print 'vret = ', vret
killall('VDCIApp', signal.SIGKILL)
if vwpid == self.vdciapp_pid :
self.vdciapp_pid = None
break
else :
print 'killl VDCI again'
except:
print 'vdci kill error?'
self.vdciapp_pid = None
break
try:
os.unlink(config.vdci_socket_path)
except:
print 'exception: vdci_socket unlink error -- can proceed...'
'''
if self.run_recv_thread != None:
runtime.evas.input_remove(self.run_recv_thread)
self.run_recv_thread = None
if self.vdciapp_pid:
print 'vdci pid = ', self.vdciapp_pid
try:
import signal, time
os.kill(self.vdciapp_pid, signal.SIGTERM) #signal.SIGKILL
time.sleep(0.5)
os.kill(self.vdciapp_pid, signal.SIGKILL)
vwpid, vret = os.waitpid(self.vdciapp_pid, 0)
print 'vwpid = ', vwpid
print 'vret = ', vret
killall('VDCIApp', signal.SIGKILL)
if vwpid == self.vdciapp_pid :
self.vdciapp_pid = None
else :
print 'killl VDCI again'
self.kill_vdciapp()
return
except:
print 'vdci kill error?'
pass
def hdl_sigchld(signum, frame): # clean a zombie
try:
while 1:
print 'MMW os wait pid 5'
# if os.waitpid(0, os.WNOHANG): raise OSError
wpid, ret = os.waitpid(0, os.WNOHANG)
print 'wpid =', wpid
print 'ret = ', ret
if self.vdciapp_pid == wpid :
self.vdciapp_pid = None
break
except OSError:
pass
# self.vdciapp_pid = None
# signal.signal(signal.SIGCHLD, hdl_sigchld)
try:
os.unlink(config.vdci_socket_path)
except:
print 'exception: vdci_socket unlink error -- can proceed...'
'''
def set_register_status(self, reg_status=True):
#Roxia Begin jhbang 06.03.24
if reg_status:
#if reg_status == True:
#Roxia End jhbang
status.set_regstatus(1)
#status.registered_status = 1
status.set_register_mode(status.Registered)
if profile.profile.get_profile() == 1: # lan
status.LanConnected = True
else:
roxia_trace('### vdciapp.set_register_status(), NotRegistered')
status.set_regstatus(0)
#status.registered_status = 0
status.set_register_mode(status.NotRegistered)
if runtime.manager.stage.get_name() == 'idle':
runtime.manager.stage.ui.update_register()
def vm_server_incoming(self):
_chan1, _mesg1, _mesg2, _mesg3, _mesg4, _mesg5 = self.vmIncomingData
if _mesg1 == '0': # media is audio
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
#status.set_video_mode(status.AudioIncoming)
import model
current_stage_name = runtime.manager.stage.get_name()
runtime.mmiDebug.mmiTrace('current stage : ' , current_stage_name)
if current_stage_name == 'copyfromstage' or current_stage_name == 'copytostage':
runtime.manager.back_stage()
if setting.autoAnswer:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, '2', self.myCardInfo))
else:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5, self.myCardInfo))
else: # video call or supervision
#status.set_video_mode(status.VideoIncoming)
if setting.video_supervision_enable == 1 and _mesg3 != '' and _mesg3 in setting.supervision_number:
if runtime.dspg.get_state() == runtime.dspg.ST_IDLE and status.supervision_not_allowed == 0 and status.update_section == False:
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
# supervision
import tdeservice
runtime.manager.stack_stage(tdeservice.SupervisionConnectedStage(runtime.manager.stage.get_name(), runtime.manager.stage.ui))
else: # reject. someone else is using the phone
self.send_mesg(code1=config.MESG_INCOMING_CALL, code2=config.MESG_CALL_REJECT, mesg1=config.REASON_LINE_BUSY)
status.release_channel()
status.clear_current_call_status()
status.reset_call_status()
else:
self.send_mesg(code1=config.MESG_PLAY_RINGBACK, code2=config.MESG_PLAY_RINGBACK, chan1=int(_chan1))
import model
if setting.autoAnswer:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, '2', self.myCardInfo))
else:
runtime.manager.change_stage(model.IncomingCallStage(_mesg1, _mesg2, _mesg3, _mesg4, _mesg5, self.myCardInfo))
vdcitone_is_playing_tone = False
vdcitone_tone = config.PLAY_DIAL_TONE
vdcitone_pid_player = None
def vdcitone_play_tone(tone=None):
global vdcitone_is_playing_tone
global vdcitone_tone
# KA: [20080226] tone play --> playulaw로 임시 변경
'''
global vdcitone_pid_player
if tone == config.PLAY_DIAL_TONE:
vdcitone_pid_player = utils.player.play(config.dial_tone_melody, change_state=False)
elif tone == config.PLAY_RINGBACK_TONE:
vdcitone_pid_player = utils.player.play(config.ringback_tone_melody, change_state=False)
elif tone == config.PLAY_BUSY_TONE:
vdcitone_pid_player = utils.player.play(config.busy_tone_melody, change_state=False)
elif tone == config.PLAY_CG_TONE:
vdcitone_pid_player = utils.player.play(config.cg_tone_melody, change_state=False)
else:
pass
'''
# KA: [20080226] tone play --> playulaw로 임시 변경 ==
devices = runtime.SP_context.getCurrentDevice()
for device in devices:
physicalDevice = runtime.SP_context.getPhysicalDevice(device)
if tone == config.PLAY_DIAL_TONE:
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_ACTIVE, \
mesg1=config.PLAY_DIAL_TONE, mesg2=0, mesg3=physicalDevice)
elif tone == config.PLAY_RINGBACK_TONE:
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_ACTIVE, \
mesg1=config.PLAY_RINGBACK_TONE, mesg2=0, mesg3=physicalDevice)
elif tone == config.PLAY_BUSY_TONE:
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_ACTIVE, \
mesg1=config.PLAY_BUSY_TONE, mesg2=0, mesg3=physicalDevice)
elif tone == config.PLAY_CG_TONE:
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_ACTIVE, \
mesg1=config.PLAY_CG_TONE, mesg2=0, mesg3=physicalDevice)
else: # DTMF
from vdcisetting import vdci_setting
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_ACTIVE, \
mesg1=tone, mesg2=vdci_setting.dtmf_duration, mesg3=physicalDevice)
vdcitone_tone = tone
vdcitone_is_playing_tone = True
def vdcitone_stop_tone(tone=None, physicalDevice=None):
global vdcitone_is_playing_tone
global vdcitone_tone
if vdcitone_is_playing_tone == False:
vdcitone_tone = None
return
if physicalDevice:
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_DEACTIVE, mesg3=physicalDevice)
else:
oringDevice = 0
devices = runtime.SP_context.getCurrentDevice()
for device in devices:
physicalDevice = runtime.SP_context.getPhysicalDevice(device)
oringDevice = oringDevice | physicalDevice
runtime.vdci_send_mesg(code1=config.MESG_PLAY_TONE, code2=config.MESG_PLAY_TONE_DEACTIVE, mesg3=oringDevice)
vdcitone_is_playing_tone = False
vdcitone_tone = None
def vdcitone_is_playing():
global vdcitone_is_playing_tone
return vdcitone_is_playing_tone
def vdcitone_set_playing(state):
global vdcitone_is_playing_tone
vdcitone_is_playing_tone = state
def g_set_screen_clip(off=False):
if off:
runtime.evas.set_clip()
return
elif status.videocall_dimension == config.DIMENSION_REMOTE_BIG_ONLY_WQVGA and \
status.videocall_mute == status.VideoMuteOn:
runtime.evas.set_clip(0, 0, 480, 272)
elif status.videocall_dimension == config.DIMENSION_REMOTE_BIG_ONLY_CIF and \
status.videocall_mute == status.VideoMuteOff:
runtime.evas.set_clip(0, 0, 480, 272)
elif status.videocall_dimension == config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_TOP:
runtime.evas.set_clip(0, 0, 480, 272)
elif status.videocall_dimension == config.DIMENSION_REMOTE_BIG_LOCAL_SMALL_WQVGA:
print 'g_set_screen_clip ===============352x272/small'
runtime.evas.set_clip(0, 0, 352, 272)
runtime.evas.set_clip(356, 150, 120, 90)
# elif status.videocall_dimension == config.DIMENSION_REMOTE_CENTER:
# runtime.evas.set_clip(72, 48, 176, 144)