If the INVITE comes in from Asterisk, OpenSER replies with 480 and lets Asterisk deal with sending call to voicemail (e.g. dialstatus = unavailable). This eliminates the loop because the INVITE does not come back to Asterisk.
El Thursday 10 April 2008 23:00:28 Adrian A escribió:
> Here is how I solve this.I can't understand why that should work, in fact Asterisk is receiving the
>
> In Asterisk, I add a SIP header just before sending it to OpenSER using the
> function: SipAddHeader(P-hint: From Asterisk).
>
> Then, in OpenSER I have the following:
>
> # check to see if user is online
> if (!lookup("location")) {
> # SIP from Asterisk or not a call attempt
> if (search("(P-hint):.From Asterisk") ||
> !(method==INVITE)) { sl_send_reply("480","User Temporarily Unavailable");
> exit;
> } else {
> route(2);
> exit;
> };
> };
>
> route[2] {
> # Let Asterisk deal with voicemail/forward
> sl_send_reply("181", "Forward to Voicemail");
> prefix("vm");
> setflag(9); # forward to Asterisk
> route(1);
> }
same INVITE he sent (well, RURI modified but the Asterisk bug is that it
doesn't recogniza a spiral).