]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
inital stubs for a few inbound reg helper functions. prototypes likely to change.
authorMichael Jerris <mike@jerris.com>
Sat, 12 May 2007 02:40:32 +0000 (02:40 +0000)
committerMichael Jerris <mike@jerris.com>
Sat, 12 May 2007 02:40:32 +0000 (02:40 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5163 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/iax/src/iax-client.h
libs/iax/src/iax.c
src/mod/endpoints/mod_iax/mod_iax.c

index 2f0faf71cd27025f2d2deff1aee664671c84f130..5a14fe62374c8730f3b9d71c79ec09664d1bde56 100644 (file)
@@ -162,6 +162,9 @@ extern int iax_send_text(struct iax_session *session, char *text);
 extern int iax_send_ping(struct iax_session *session);
 extern int iax_load_complete(struct iax_session *session);
 extern int iax_reject(struct iax_session *session, char *reason);
+int iax_reject_registration(struct iax_session *session, char *reason);
+int iax_ack_registration(struct iax_session *session);
+int iax_auth_registration(struct iax_session *session);
 extern int iax_busy(struct iax_session *session);
 extern int iax_congestion(struct iax_session *session);
 extern int iax_hangup(struct iax_session *session, char *byemsg);
index 0639f2effb075cfffa8526bf3a8b74bd4e31d2f0..19004b05a4df9dcbcf2b979771dfd0d0a4f33575 100644 (file)
@@ -1255,7 +1255,11 @@ static int send_command_final(struct iax_session *i, char type, int command, uns
 #endif 
        int r;
        r = __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1, 0);
-       if (r >= 0) destroy_session(i);
+       if (r >= 0) {
+               iax_mutex_lock(session_mutex); 
+               destroy_session(i);
+               iax_mutex_unlock(session_mutex);
+       }
        return r;
 }
 
@@ -1669,6 +1673,24 @@ int iax_register(struct iax_session *session, char *server, char *peer, char *se
        return res;
 }
 
+int iax_reject_registration(struct iax_session *session, char *reason)
+{
+       struct iax_ie_data ied;
+       memset(&ied, 0, sizeof(ied));
+       iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? (unsigned char *) reason : (unsigned char *) "Unspecified");
+       return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGREJ, 0, ied.buf, ied.pos, -1);
+}
+
+int iax_ack_registration(struct iax_session *session)
+{
+       return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGACK, 0, NULL, 0, -1);
+}
+
+int iax_auth_registration(struct iax_session *session)
+{
+       return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGAUTH, 0, NULL, 0, -1);
+}
+
 int iax_reject(struct iax_session *session, char *reason)
 {
        struct iax_ie_data ied;
index ca84c6de75f347b400aadcaffc3854bf83b13478..3f93afe4ceff75b2421e24fd121afb0e9bd542df 100644 (file)
@@ -1038,9 +1038,7 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
                                break;
                        case IAX_EVENT_REGREQ:
                                /* what is the right way to handle this? */
-                               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registration request ignored, not implemented.\n");
-                               iax_destroy(iaxevent->session);
-                               iaxevent->session = NULL;
+                               iax_reject_registration(iaxevent->session, NULL);
                                break;
                        case IAX_EVENT_TIMEOUT:
                                break;