[Kamailio-Users] Question about redirect if user is not online
Daniel-Constantin Mierla
miconda at gmail.com
Tue Sep 23 11:22:23 CEST 2008
Hello,
On 09/23/08 12:07, Ali Jawad wrote:
> Hi
> Thanks for your suggestion
>
> I did enter the username and the mobile number into the usr_preferences
> table and tried the below
>
> ####### AVPOPS Section
> modparam("avpops","avp_url","mysql://openser:xyxyxy@xxxxxxxxxxxx/openser
> ")
> modparam("avpops","avp_table","usr_preferences")
>
> In the route statement I did add
>
> if(avp_db_load("$ruri/username","s:callfwd")){
> avp_pushto("$ruri","s:callfwd");
> route(8);
> exit;
> };
>
> I got this error
>
> Sep 23 09:21:03 [340] ERROR:avpops:parse_avp_db: error - bad avp flags
> Sep 23 09:21:03 [340] ERROR:avpops:fixup_db_avp: parse failed Sep 23
> 09:21:03 [340] ERROR:core:fix_actions: fixing failed (code=-1) at cfg
> line 307 Sep 23 09:21:03 [340] CRITICAL:core:fix_expr: fix_actions error
>
> Did I miss anything >?
>
it should be:
if(avp_db_load("$ruri/username","$avp(s:callfwd)")){
avp_pushto("$ruri","$avp(s:callfwd)");
route(8);
exit;
};
insetead of avp_pushto("$ruri","$avp(s:callfwd)") you can do:
$ru = $avp(s:callfwd);
I assume $avp(s:callfwd) has a complete sip uri as value, if it is just
the number, then use:
avp_pushto("$ruri/username","$avp(s:callfwd)");
or
$rU = $avp(s:callfwd);
Cheers,
Daniel
>
>
> -----Original Message-----
> From: Daniel-Constantin Mierla [mailto:miconda at gmail.com]
> Sent: 2008-09-23 11:53
> To: Ali Jawad
> Cc: users
> Subject: Re: [Kamailio-Users] Question about redirect if user is not
> online
>
> Hello,
>
> On 09/22/08 16:16, Ali Jawad wrote:
>
>> Hi
>> I got the below fixed, however I do need to achieve something else as
>> well. When I forward the call to asterisk I need asterisk to forward
>> it in turn to my cellphone number. Where an how should I re-write the
>> DID number of my SIP packet that acts as the destination URI to my
>> cell phone number.
>>
>>
>>
>>
> to be sure I understand your needs, if the user is not online, you want
> to send the call to user's mobile.
>
> Perhaps you already have the mobile number in some table in database.
> You can use avp_db_query() to load it in an AVP (see avpops module for
> more).
>
> avp_db_query("select __gsm_number__ from __your_table__ where
> username='$rU'", "$avp(s:gsm_number)");
>
> if(is_avp_set("$avp(s:gsm_number)"))
> {
> $rU = $avp(s:gsm_number);
> $rd = "__your_pstn_gw_ip__";
> t_relay();
> exit;
> }
>
> Hope it helps,
> Daniel
>
>
--
Daniel-Constantin Mierla
http://www.asipto.com
More information about the Users
mailing list