Stefan Sayer writes:
> default onInvite method should be called, as it replies with 200 OK,
> which triggers starting the session etc. That method is only called
> when you return True in the onInvite method:
>
> o Juha Heinanen on 10/20/2011 08:48 AM:
> > def onInvite(self, hdrs):
> > info("At announcement onInvite")
> return True
>
> This is so that onInvite could send a reply and stop the call with
> self.stopSession(), and then return False, such that the default
> onInvite handler is not called.
stefan,
thanks for the info. the solution was easy.
when i did more tests, i found that onInvite is also called on
re-invites. when re-invite arrives, my example onInvite script
def onInvite(self, hdrs):
info("Received announcement INVITE")
self.params = P_App_Param(getHeader(hdrs, "P-App-Param"))
self.file = self.params.getKeyValue("File")
if not self.file:
self.file = "/tmp/default.wav"
return True
results in error:
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] INFO:
Ivr-Python: Received announcement INVITE
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] ERROR:
Ivr-Python: ********** Ivr-Python exception report ****************
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] ERROR:
Ivr-Python: <type 'exceptions.IndexError'> raised: list index out of range
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] ERROR:
Ivr-Python: File './p_app_param/p_app_param.py': line 9
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] ERROR:
Ivr-Python: File './ivr_ann.py': line 13
Oct 21 11:17:07 sip sems[3725]: [#b53f1b70] [ivr_log, Ivr.cpp:78] ERROR:
Ivr-Python: ********** end of Ivr-Python exception report *********
because re-invite does not have P-App-Param header.
in 1.4 this was not a problem, because i only had onSessionStart script,
which is not executed on invite.
now the question is, is there a function to test if invite is reinvite
or do i need to start looking for to tag?
-- juha
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev