Hi, this implement a basic callback to manage incoming options events.

Please note that maybe this isn't the correct approach, indeed with
this approach sofsip_cli always returns 200 OK, while RFC 3261 states:

|The response to an OPTIONS is constructed using the standard rules for
|a SIP response as discussed in Section 8.2.6.  The response code
|chosen MUST be the same that would have been chosen had the request
|been an INVITE.  That is, a 200 (OK) would be returned if the UAS is
|ready to accept a call, a 486 (Busy Here) would be returned if the UAS
|is busy, etc.  This allows an OPTIONS request to be used to determine
|the basic state of a UAS, which can be an indication of whether the
|UAS will accept an INVITE request.

Can you suggest how can I access the global state of the application
(for example: ready, busy, etc.)?

BTW, I noted that even when the incoming options event is not managed,
I got this message from the receiving application:

sofsip> UA: unknown event 'nua_i_options' (10): 200 OK
   ::tag_null: 0

then a response message is currently sent. How can I override this
mechanism, for example how can I control which kind of response
message to send? (For example in the abovementioned case, when I want
to send a message telling the application is busy.)

Thanks in advance for any advice, regards.
--- old-sofsip-cli/src/ssc_sip.c	2008-07-04 14:20:10.000000000 +0200
+++ new-sofsip-cli/src/ssc_sip.c	2008-07-04 14:20:10.000000000 +0200
@@ -145,6 +145,9 @@
 void ssc_r_notify(int status, char const *phrase, nua_t *nua, ssc_t *ssc,
 		   nua_handle_t *nh, ssc_oper_t *op, sip_t const *sip,
 		   tagi_t tags[]);
+void ssc_i_options(int status, char const *phrase, nua_t *nua, ssc_t *ssc,
+		   nua_handle_t *nh, ssc_oper_t *op, sip_t const *sip,
+		   tagi_t tags[]);
 void ssc_r_options(int status, char const *phrase, nua_t *nua, ssc_t *ssc,
 		   nua_handle_t *nh, ssc_oper_t *op, sip_t const *sip,
 		   tagi_t tags[]);
@@ -466,6 +469,10 @@
     ssc_r_unregister(status, phrase, nua, ssc, nh, op, sip, tags);
     break;
     
+  case nua_i_options:
+    ssc_i_options(status, phrase, nua, ssc, nh, op, sip, tags);
+    break;
+
   case nua_r_options:
     ssc_r_options(status, phrase, nua, ssc, nh, op, sip, tags);
     break;
@@ -1234,6 +1241,17 @@
 }
 
 /**
+ * Callback to an incoming OPTIONS request.
+ */
+void ssc_i_options(int status, char const *phrase,
+		   nua_t *nua, ssc_t *ssc,
+		   nua_handle_t *nh, ssc_oper_t *op, sip_t const *sip,
+		   tagi_t tags[])
+{
+  printf("%s: OPTIONS received\n", ssc->ssc_name);
+}
+
+/**
  * Callback to an outgoing OPTIONS request.
  */
 void ssc_r_options(int status, char const *phrase,

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to