Author Topic: Redirect the call  (Read 19990 times)

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Redirect the call
« on: July 18, 2014, 05:49:59 AM »
Hello!!! Im kirill and learn yate.

I have a question.
How does the routing of calls and how you can change it. Such as changing the number of the call through the message "%%> message" and "%% <message".
What parameters message by yate I need to change to redirect the call and how i can do it.

I install call.execute and i think that change parameter -   callto=sip/sip%z111@172.17.2.44%z59122 where 111 - number of changing  call and  59122  - number port, and parameter sip_from=sip%z127@172.17.2.181%5060 - outgoing call, i can redirect the call.

But i get arror - call ended. Maybe I left out some of the parameters for the call?
I know about regexroute.conf (Regular expressions) but i want to understand how work routing the call through the "%% <message".

THANK YOU FOR YOUR HELP

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #1 on: July 21, 2014, 12:44:34 AM »
Here is the entry point for routing:
http://docs.yate.ro/wiki/Routing

If something don't work as expected please post a log with yate messages and sip signalling.
See:
http://docs.yate.ro/wiki/Starting_Yate
http://docs.yate.ro/wiki/Debugging_in_Yate
http://docs.yate.ro/wiki/Debugging_and,_or_Investigation_of_messages

Some note:
You don't have to change callto in call.execute. Just set return value to desired target in call.route.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #2 on: July 21, 2014, 07:22:34 AM »
Thanks for you answer!  My basic idea is to redirect the call to change the parameters for messages

I install message "call.route" and catch '%%<message'. I get message -

%%>message:0xb54ff030.358673859:1405946018:call.route::id=sip/2:module=sip:status=incoming:address=172.17.2.44%z53388:billid=1405945803-2:answered=false:direction=incoming:callid=sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/:caller=127:called=127:callername=mkv:antiloop=19:ip_host=172.17.2.44:ip_port=53388:ip_transport=UDP:sip_uri=sip%z127@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181%z5060:sip_to=<sip%z127@172.17.2.181%z5060>:sip_callid=YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.:device=3CXPhone 6.0.18815.0:sip_contact=<sip%z127@172.17.2.44%z53388;rinstance=6ef857baa4e8b41a>:sip_allow=INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE:sip_content-type=application/sdp:sip_supported=replaces:sip_user-agent=3CXPhone 6.0.18815.0:rtp_addr=172.17.2.44:media=yes:formats=mulaw,alaw:transport=RTP/AVP:rtp_rfc2833=101:rtp_port=40024:sdp_sendrecv=:media_video=yes:formats_video=:transport_video=RTP/AVP:rtp_port_video=40022:sdp_video_sendrecv=:rtp_forward=possible:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50

Then i changed the follow parameters of message(change the number of call - 111 instead 127):
param['sip_contact'] = <sip%z127@172.17.2.44%z53388;rinstance=6ef857baa4e8b41a>
param['called'] = '111'
param['sip_to'] =<sip%z111@172.17.2.181%z5060>
param['sip_uri'] = sip%z111@172.17.2.181%z5060
param['sip_from'] = sip%z127@172.17.2.181%z5060
And i sent the message into the yate - %%<message:0xb54ff030.358673859:true:call.route::id=sip/2:callername=mkv:caller=127:called=111:address=172.17.2.44%z53388:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50:ip_port=53388:sip_uri=sip%z111@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181%z5060:sip_to=<sip%z111@172.17.2.181%z5060>:sip_callid=YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.:sip_contact=<sip%z127@172.17.2.44%z53388;rinstance=6ef857baa4e8b41a>:sip_allow=INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE:module=sip:status=incoming:billid=1405945803-2:answered=false:direction=incoming:callid=sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/

And i get the error - destination not found.

May be i must change another messages like - chan.startup, call.preroute.
And is possible to change the redirect the number of call to change the parametes of message?

Below i show yate messages:
essage sniffer is on
Sniffed 'user.auth' time=1405946017.857272
  thread=0x969c668 'YSIP EndPoint'
  data=(nil)
  retval='(null)'
  param['protocol'] = 'sip'
  param['method'] = 'INVITE'
  param['uri'] = 'sip:127@172.17.2.181:5060'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['address'] = '172.17.2.44:53388'
  param['newcall'] = 'true'
  param['domain'] = '172.17.2.181'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['caller'] = '127'
  param['called'] = '127'
  param['billid'] = '1405945803-2'
Returned false 'user.auth' delay=0.020398
  thread=0x969c668 'YSIP EndPoint'
  data=(nil)
  retval='(null)'
  param['protocol'] = 'sip'
  param['method'] = 'INVITE'
  param['uri'] = 'sip:127@172.17.2.181:5060'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['address'] = '172.17.2.44:53388'
  param['newcall'] = 'true'
  param['domain'] = '172.17.2.181'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['caller'] = '127'
  param['called'] = '127'
  param['billid'] = '1405945803-2'
  param['handlers'] = 'monitoring:1,regfile:100'
Sniffed 'chan.startup' time=1405946017.892234
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '127'
Returned false 'chan.startup' delay=0.011137
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '127'
  param['handlers'] = 'javascript:15,pbxassist:15,cdrbuild:50'
Sniffed 'call.cdr' time=1405946017.903302 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'initialize'
  param['direction'] = 'incoming'
  param['duration'] = '0.011'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'incoming'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
Sniffed 'call.preroute' time=1405946017.857031
  thread=0xb5306570 'Call Router'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '127'
  param['callername'] = 'mkv'
  param['antiloop'] = '19'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['sip_uri'] = 'sip:127@172.17.2.181:5060'
  param['sip_from'] = 'sip:127@172.17.2.181:5060'
  param['sip_to'] = '<sip:127@172.17.2.181:5060>'
  param['sip_callid'] = 'YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['sip_contact'] = '<sip:127@172.17.2.44:53388;rinstance=6ef857baa4e8b41a>'
  param['sip_allow'] = 'INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE'
  param['sip_content-type'] = 'application/sdp'
  param['sip_supported'] = 'replaces'
  param['sip_user-agent'] = '3CXPhone 6.0.18815.0'
  param['rtp_addr'] = '172.17.2.44'
  param['media'] = 'yes'
  param['formats'] = 'mulaw,alaw'
  param['transport'] = 'RTP/AVP'
  param['rtp_rfc2833'] = '101'
  param['rtp_port'] = '40024'
  param['sdp_sendrecv'] = ''
  param['media_video'] = 'yes'
  param['formats_video'] = ''
  param['transport_video'] = 'RTP/AVP'
  param['rtp_port_video'] = '40022'
  param['sdp_video_sendrecv'] = ''
  param['rtp_forward'] = 'possible'
Returned false 'call.preroute' delay=0.079908
  thread=0xb5306570 'Call Router'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '127'
  param['callername'] = 'mkv'
  param['antiloop'] = '19'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['sip_uri'] = 'sip:127@172.17.2.181:5060'
  param['sip_from'] = 'sip:127@172.17.2.181:5060'
  param['sip_to'] = '<sip:127@172.17.2.181:5060>'
  param['sip_callid'] = 'YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['sip_contact'] = '<sip:127@172.17.2.44:53388;rinstance=6ef857baa4e8b41a>'
  param['sip_allow'] = 'INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE'
  param['sip_content-type'] = 'application/sdp'
  param['sip_supported'] = 'replaces'
  param['sip_user-agent'] = '3CXPhone 6.0.18815.0'
  param['rtp_addr'] = '172.17.2.44'
  param['media'] = 'yes'
  param['formats'] = 'mulaw,alaw'
  param['transport'] = 'RTP/AVP'
  param['rtp_rfc2833'] = '101'
  param['rtp_port'] = '40024'
  param['sdp_sendrecv'] = ''
  param['media_video'] = 'yes'
  param['formats_video'] = ''
  param['transport_video'] = 'RTP/AVP'
  param['rtp_port_video'] = '40022'
  param['sdp_video_sendrecv'] = ''
  param['rtp_forward'] = 'possible'
  param['handlers'] = 'javascript:15,regexroute:100'
Sniffed 'call.route' time=1405946017.857031
  thread=0xb5306570 'Call Router'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '127'
  param['callername'] = 'mkv'
  param['antiloop'] = '19'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['sip_uri'] = 'sip:127@172.17.2.181:5060'
  param['sip_from'] = 'sip:127@172.17.2.181:5060'
  param['sip_to'] = '<sip:127@172.17.2.181:5060>'
  param['sip_callid'] = 'YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['sip_contact'] = '<sip:127@172.17.2.44:53388;rinstance=6ef857baa4e8b41a>'
  param['sip_allow'] = 'INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE'
  param['sip_content-type'] = 'application/sdp'
  param['sip_supported'] = 'replaces'
  param['sip_user-agent'] = '3CXPhone 6.0.18815.0'
  param['rtp_addr'] = '172.17.2.44'
  param['media'] = 'yes'
  param['formats'] = 'mulaw,alaw'
  param['transport'] = 'RTP/AVP'
  param['rtp_rfc2833'] = '101'
  param['rtp_port'] = '40024'
  param['sdp_sendrecv'] = ''
  param['media_video'] = 'yes'
  param['formats_video'] = ''
  param['transport_video'] = 'RTP/AVP'
  param['rtp_port_video'] = '40022'
  param['sdp_video_sendrecv'] = ''
  param['rtp_forward'] = 'possible'
  param['handlers'] = 'javascript:15,regexroute:100'
Returned false 'call.cdr' delay=0.051039 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'initialize'
  param['direction'] = 'incoming'
  param['duration'] = '0.011'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'incoming'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
  param['handlers'] = 'queuesnotify:10'
Sniffed 'call.cdr' time=1405946017.938472 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'update'
  param['direction'] = 'incoming'
  param['duration'] = '0.046'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'incoming'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
Returned false 'call.cdr' delay=0.068951 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'update'
  param['direction'] = 'incoming'
  param['duration'] = '0.046'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'incoming'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
  param['handlers'] = 'queuesnotify:10'
Returned true 'call.route' delay=0.151152
  thread=0xb5306570 'Call Router'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['caller'] = '127'
  param['called'] = '111'
  param['callername'] = 'mkv'
  param['antiloop'] = '19'
  param['ip_host'] = '172.17.2.44'
  param['ip_port'] = '53388'
  param['ip_transport'] = 'UDP'
  param['sip_uri'] = 'sip:111@172.17.2.181:5060'
  param['sip_from'] = 'sip:127@172.17.2.181:5060'
  param['sip_to'] = '<sip:111@172.17.2.181:5060>'
  param['sip_callid'] = 'YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY.'
  param['device'] = '3CXPhone 6.0.18815.0'
  param['sip_contact'] = '<sip:127@172.17.2.44:53388;rinstance=6ef857baa4e8b41a>'
  param['sip_allow'] = 'INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE'
  param['sip_content-type'] = 'application/sdp'
  param['sip_supported'] = 'replaces'
  param['sip_user-agent'] = '3CXPhone 6.0.18815.0'
  param['rtp_addr'] = '172.17.2.44'
  param['media'] = 'yes'
  param['formats'] = 'mulaw,alaw'
  param['transport'] = 'RTP/AVP'
  param['rtp_rfc2833'] = '101'
  param['rtp_port'] = '40024'
  param['sdp_sendrecv'] = ''
  param['media_video'] = 'yes'
  param['formats_video'] = ''
  param['transport_video'] = 'RTP/AVP'
  param['rtp_port_video'] = '40022'
  param['sdp_video_sendrecv'] = ''
  param['rtp_forward'] = 'possible'
  param['handlers'] = 'javascript:15,regexroute:100,javascript:15,cdrbuild:50'
Sniffed 'chan.hangup' time=1405946018.029888
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'rejected'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['reason'] = 'No route to call target'
Returned false 'chan.hangup' delay=0.038876
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'rejected'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/YjhjNjJkMWRkZjQ0ODFiZTNhNzY1ZTA2YWJkMjhiNjY./1d1e6157/'
  param['reason'] = 'No route to call target'
  param['handlers'] = 'javascript:15,pbxassist:15,queues:20,yrtp:50,gvoice:50,monitoring:100,conf:150,cdrbuild:150'
Sniffed 'call.cdr' time=1405946018.068720 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'finalize'
  param['direction'] = 'incoming'
  param['duration'] = '0.138'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'rejected'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
  param['reason'] = 'No route to call target'
Returned false 'call.cdr' delay=0.087007 (broadcast)
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['time'] = '1405946017.892'
  param['chan'] = 'sip/2'
  param['cdrid'] = '2'
  param['runid'] = '1405945803'
  param['operation'] = 'finalize'
  param['direction'] = 'incoming'
  param['duration'] = '0.138'
  param['billtime'] = '0.000'
  param['ringtime'] = '0.000'
  param['status'] = 'rejected'
  param['external'] = '127'
  param['cdrwrite'] = 'true'
  param['address'] = '172.17.2.44:53388'
  param['billid'] = '1405945803-2'
  param['caller'] = '127'
  param['called'] = '127'
  param['reason'] = 'No route to call target'
  param['handlers'] = 'queuesnotify:10'
Sniffed 'module.update' time=1405946023.003157
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['module'] = 'sip'
  param['failed_auths'] = '0'
  param['transaction_timeouts'] = '0'
  param['bye_timeouts'] = '0'
Returned true 'module.update' delay=0.014192
  thread=0x974a460 'Engine Worker'
  data=(nil)
  retval='(null)'
  param['module'] = 'sip'
  param['failed_auths'] = '0'
  param['transaction_timeouts'] = '0'
  param['bye_timeouts'] = '0'
  param['handlers'] = 'engine:1,monitoring:100'
  param['nodename'] = 'Komunikator'
sniffer off

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #3 on: July 21, 2014, 07:32:31 AM »
If you handle call.route just set the message return value to sip target you want to call.

PHP example (assuming $ev is the handled message):
$ev->retval = "sip/sip:111@172.17.2.181:5060";

Javascript example (assuming msg is the handled message):
msg.retValue("sip/sip:111@172.17.2.181:5060");

I don't understand what kind of script you are using.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #4 on: July 21, 2014, 07:50:04 AM »
 I write in nodejs (chief task) and the receiving/sending messages through the stdin/stdout.

 I have a question. What parameters do I pass to yate '%%<message'. All of them <key>=<value>, or that does not import

Ok I try to do as you told me.

Thanks for your help.

 

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #5 on: July 21, 2014, 07:55:50 AM »
For external script protocol see:
http://docs.yate.ro/wiki/External_module_command_flow
You'll find there what do you need to write to socket for message params and data.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #6 on: July 22, 2014, 02:51:55 AM »
I think the condition $ ev-> retval = "sip / sip: 111@172.17.2.181: 5060" is not sufficient to redirect the call.

I formed a response from Yate in accordance with http://yate.null.ro/docs/extmodule.html

I install 'call.route'. Then i get a message %%>message:0xb4e2c030.387927169:1406017585:call.route::id=sip/4:module=sip:status=incoming:address=172.17.2.44%z63408:billid=1406016613-3:answered=false:direction=incoming:callid=sip/NzU2ODNiOTAzOGU0M2QyNmMxNTU3ODVmZDg3MTI2NDc./f7698575/:caller=127:called=127:callername=mkv:antiloop=19:ip_host=172.17.2.44:ip_port=63408:ip_transport=UDP:sip_uri=sip%z127@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181%z5060:sip_to=<sip%z127@172.17.2.181%z5060>:sip_callid=NzU2ODNiOTAzOGU0M2QyNmMxNTU3ODVmZDg3MTI2NDc.:device=3CXPhone 6.0.18815.0:sip_contact=<sip%z127@172.17.2.44%z63408;rinstance=7a023e3ebf59e299>:sip_allow=INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE:sip_content-type=application/sdp:sip_supported=replaces:sip_user-agent=3CXPhone 6.0.18815.0:rtp_addr=172.17.2.44:media=yes:formats=mulaw,alaw:transport=RTP/AVP:rtp_rfc2833=101:rtp_port=40024:sdp_sendrecv=:media_video=yes:formats_video=:transport_video=RTP/AVP:rtp_port_video=40022:sdp_video_sendrecv=:rtp_forward=possible:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50


I answered this message - %%<message:0xb4e2c030.387927169:true:call.route:sip/sip%z111@172.17.2.181%z5060


Then yate send me a message confirming the change in routing (As I understand it) - %%>message:0xb4e2c030.2005106673:1406017585:call.route::id=sip/6:module=sip:status=incoming:address=172.17.2.181%z5060:billid=1406016613-4:answered=false:direction=incoming:callid=sip/99729918@172.17.2.181/1006198680/:caller=127:called=111:callername=mkv:antiloop=18:ip_host=172.17.2.181:ip_port=5060:ip_transport=UDP:sip_uri=sip%z111@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181:sip_to=<sip%z111@172.17.2.181%z5060>:sip_callid=99729918@172.17.2.181:device=YATE/4.3.0:sip_user-agent=YATE/4.3.0:sip_contact=<sip%z127@172.17.2.181%z5060>:sip_allow=ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO:sip_content-type=application/sdp:rtp_addr=172.17.2.181:media=yes:formats=mulaw,alaw:transport=RTP/AVP:rtp_rfc2833=101:rtp_port=19748:rtp_forward=possible:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50

I answered for this message  - %%<message:0xb4e2c030.2005106673:false:call.route:
Parameter "false" told yate that message not processed and yate continue work.

But i get error - "Authentication failed"
Maybe I should add in response to yate some of the parameters?
I tried to call without call redirect, are normally (127 call 127  and 127 call 111 )

I have no idea what's happend.

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #7 on: July 22, 2014, 03:04:21 AM »
Can you tell what do you want to achieve?
If you want to send an incoming call to a destination (e.g. route the call): setting the return value of call.route does the job.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #8 on: July 22, 2014, 03:32:49 AM »
 For example i learn yate. And I need to implement an example library on nodejs voice menu with the possibility of routing calls. Example of a call to 127 127 was chosen as an example.

And the realization is almost similar to the libraries on php. Of course now I only understand the possibilities of yate.

With regard to my question - what happens is why yate does not want to change the routing?

Documentation on these issues do not

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #9 on: July 22, 2014, 03:41:06 AM »
Can you post the log with failed call?
Including sip messages and other yate debug messages.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #10 on: July 22, 2014, 04:14:29 AM »
what I did with messages (%%>message and %%<message) - I told in Reply #6 (earlier today).

first message from yate - %%>message:0xb54ff030.1118835422:1406022894:call.route::id=sip/4:module=sip:status=incoming:address=172.17.2.44%z53625:billid=1406022813-3:answered=false:direction=incoming:callid=sip/MDhlYWEwNzBjYTFiOTlmZmM2NTFiMDdiNjZjMTg3ZTc./2c3d2240/:caller=127:called=127:callername=mkv:antiloop=19:ip_host=172.17.2.44:ip_port=53625:ip_transport=UDP:sip_uri=sip%z127@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181%z5060:sip_to=<sip%z127@172.17.2.181%z5060>:sip_callid=MDhlYWEwNzBjYTFiOTlmZmM2NTFiMDdiNjZjMTg3ZTc.:device=3CXPhone 6.0.18815.0:sip_contact=<sip%z127@172.17.2.44%z53625;rinstance=b7e53caa950513a2>:sip_allow=INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE:sip_content-type=application/sdp:sip_supported=replaces:sip_user-agent=3CXPhone 6.0.18815.0:rtp_addr=172.17.2.44:media=yes:formats=mulaw,alaw:transport=RTP/AVP:rtp_rfc2833=101:rtp_port=40024:sdp_sendrecv=:media_video=yes:formats_video=:transport_video=RTP/AVP:rtp_port_video=40022:sdp_video_sendrecv=:rtp_forward=possible:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50


I answered - %%<message:0xb54ff030.1118835422:true:call.route:sip/sip%z111@172.17.2.181%z5060

Then yate sent message - %%>message:0xb54ff030.242511929:1406022895:call.route::id=sip/6:module=sip:status=incoming:address=172.17.2.181%z5060:billid=1406022813-4:answered=false:direction=incoming:callid=sip/1408146187@172.17.2.181/501659394/:caller=127:called=111:callername=mkv:antiloop=18:ip_host=172.17.2.181:ip_port=5060:ip_transport=UDP:sip_uri=sip%z111@172.17.2.181%z5060:sip_from=sip%z127@172.17.2.181:sip_to=<sip%z111@172.17.2.181%z5060>:sip_callid=1408146187@172.17.2.181:device=YATE/4.3.0:sip_user-agent=YATE/4.3.0:sip_contact=<sip%z127@172.17.2.181%z5060>:sip_allow=ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO:sip_content-type=application/sdp:rtp_addr=172.17.2.181:media=yes:formats=mulaw,alaw:transport=RTP/AVP:rtp_rfc2833=101:rtp_port=24600:rtp_forward=possible:handlers=javascript%z15,regexroute%z100,javascript%z15,cdrbuild%z50

I answered - %%<message:0xb54ff030.242511929:false:call.route:

yate messages - below in the file

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #11 on: July 22, 2014, 04:17:32 AM »
The second call.route returned false (with error=noauth).
You must route it also.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #12 on: July 22, 2014, 04:37:03 AM »
But what parameters of messages (%%<message) I return it (the answer to the second message)?

I tried two ways ( two answers to Engine ):
%%<message:0xb557d030.1283144625:true:call.route:sip/sip%z111@172.17.2.181%z5060
%%<message:0xb557d030.1466424417:true:call.route:
error - destination not found

Second:
%%<message:0xb557d030.1283144625:true:call.route:sip/sip%z111@172.17.2.181%z5060 (repeated for each response "%%>message" n times)
 error - server failure

maybe add some parameters :<key>=<value> in the %%<message
« Last Edit: July 22, 2014, 04:38:55 AM by daimond025 »

marian

  • Hero Member
  • *****
  • Posts: 513
    • View Profile
Re: Redirect the call
« Reply #13 on: July 22, 2014, 04:49:56 AM »
You must route calls based on your policy.
When deciding to route a call you must pay attention at used criteria.
Returning the same destination (your own server) for each incoming call will lead to infinite call looping.
Fortunately SIP has a Max-Forwards header which is decremented each time a call is received. The call will be rejected when the counter reaches 0.

daimond025

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Redirect the call
« Reply #14 on: July 23, 2014, 01:48:23 AM »
Thank you for your valuable assistance

it works in yate

The question is removed