Hello Kamailions,
After the feedback from Daniel, I have tried some other things.
The php script works, for testing purposes I changed the php action to write a text file in the /tmp directory.
This works when the incoming call is handled by Kamailio, so I know the script gets executed.
But when the script echo's the needed value the kamailio line below does not receive the value in the avp variable:
exec_avp("/usr/bin/php /var/lib/kamailio/scripts/test.php
$var(timeControlId)", "$avp(s:numberid)");
I also have tried it with $avp(i:1), but both options do not work.
I am stil thinking that my php script is not presenting the value in the correct manner...
Should a value presented by an echo command be read by the exec_avp command?
Rgds,
Gertjan Wolzak
Subject: | Re: [SR-Users] reading php script result with exec_avp |
---|---|
Date: | Thu, 6 Jun 2019 09:16:12 +0200 |
From: | Gertjan Wolzak <g.wolzak@kazlow.nl> |
To: | Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org> |
Hello,
are you sure that the script is executed? You give a relative path and
kamailio changes working directory to / if you don't give -w parameter?
Try with absolute path.
Cheers,
Daniel
On 05.06.19 14:10, Gertjan Wolzak wrote:
Hello Kamailions,
I have the following challenge.
I want to create a time dependent callerid, based on the time of a
outgoing call a callerid will be set.
I have a php script, that provides me an id number which relates to an
cli.
When I run that php script from the console, the id is shown in the
console.
When I run the script within the kamailio configuration,
exec_avp("../script.php", "$avp(s:cliId)"); ,no output commande is
saved in the avp variable.
I think I am not presenting the result of the php script correctly. I
have tried with an echo $variable; and with and fwrite(STDOUT,
$variable); but no luck.
I'm not a PHP coder so I am not surprised of the missing luck, but
maybe somebody has a golden tip for me?
Rgds,
Gertjan
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users