Author Topic: How to change param of call.route in regfile module ?  (Read 7808 times)

cc08

  • Guest
How to change param of call.route in regfile module ?
« on: February 19, 2013, 01:44:40 AM »
Hi, Yate people !

Please, help me give answer on one question:
Posible to change param in call.route message by regfile module ?
From text  of regfile.conf, a I thought that YES,
But practically i think that NO.

In generally, I want to send voicemail to email from regfile.conf (expiriment with database will be later) for offline sip client.
For this I do :

1. in regexroute.conf add param 'email'
Code: [Select]
[priorities]
route=110

[default]
^118$=return;email=change_me

2. in regfile.conf change value of param 'email' to real email (what I have not obtained)
Code: [Select]
[general]
route=120

[118]
pass=qweqwe
email=real@mail

3. Global script (which executed only if client ofline) run external script 'leavemail.php' ( which send voicemail to specified address)

Code: [Select]
...
Yate::Install("call.route",150);
...
switch ($ev->type) {
case "incoming":
                    $calee=$ev->params["called"];
                    $mask='/^1..$/';
                    if (preg_match($mask,$calee)) {
                            debug("Local call: " . $ev->name . " id: " . $ev->id . " called: " . $calee . " caller: " . $ev->params["caller"]);
                            $ev->retval = "external/nodata/leavemail.php";
                            $ev->handled = true;
                    } else {
                        debug("Called number invalid: " . $calee . ", caller: " . $ev->>params["caller"]);
                        $ev->retval = "wave/play//var/spool/yate/sounds/notexsist.slin";
                        $ev->handled = true;
                    }
 ...

4. In sniffer of call.route message I see:
Code: [Select]
Returned true 'call.route' delay=0.015558
  thread=0x1bfe990 'Call Router'
  data=(nil)
  retval='external/nodata/my_leavemail.php'
  param['id'] = 'sip/2'
  param['module'] = 'sip'
  param['status'] = 'incoming'
  param['address'] = '192.168.206.95:5060'
  param['billid'] = '1361254105-2'
  param['answered'] = 'false'
  param['direction'] = 'incoming'
  param['callid'] = 'sip/D1B9-DF70-46685013FBDEDBA14B69-008@SipHost/43e52fdd-685013/'
  param['caller'] = '120'
  param['called'] = '118'
  param['callername'] = '120'
  param['antiloop'] = '19'
  param['ip_host'] = '192.168.206.95'
  param['ip_port'] = '5060'
  param['ip_transport'] = 'UDP'
  param['sip_uri'] = 'sip:118@192.168.154.18;user=phone'
  param['sip_from'] = 'sip:120@192.168.154.18'
  param['sip_to'] = '<sip:118@192.168.154.18;user=phone>'
  param['sip_callid'] = 'D1B9-DF70-46685013FBDEDBA14B69-008@SipHost'
  param['device'] = 'dlink 12-38-39811651-0.10.37.1-DSA'
  param['sip_allow'] = 'INVITE,ACK,OPTIONS,BYE,CANCEL,INFO,PRACK,REFER,SUBSCRIBE,NOTIFY,UPDATE'
  param['sip_contact'] = '<sip:120@192.168.206.95:5060>'
  param['sip_expires'] = '90'
  param['sip_supported'] = 'replaces'
  param['sip_user-agent'] = 'dlink 12-38-39811651-0.10.37.1-DSA'
  param['sip_content-type'] = 'application/sdp'
  param['rtp_addr'] = '192.168.206.95'
  param['media'] = 'yes'
  param['formats'] = 'mulaw,alaw'
  param['transport'] = 'RTP/AVP'
  param['rtp_rfc2833'] = '101'
  param['rtp_port'] = '9000'
  param['rtp_forward'] = 'possible'
  param['handlers'] = 'regexroute:100,cdrbuild:50,sip:100,regexroute:110,regfile:120'
  param['context'] = 'local'
  param['email'] = 'change_me'
  param['error'] = 'offline'

Or am I wrong something done, or is it impossible.
That suggest?

vankooch

  • Administrator
  • Newbie
  • *****
  • Posts: 49
    • View Profile
Re: How to change param of call.route in regfile module ?
« Reply #1 on: February 19, 2013, 12:25:08 PM »
If you want to add any new parameters you need to use it with copyparam, which copyies the params from ex. preroute to route and cdr msg.
And as I know it is not possible to copy parameters from regfile.conf to any other msg, out of the box, but I'm not 100% about that.
If you plan to use database later, I would start on that, so you have the email in the db and you can access it from your routing function in register.conf