[Freeswitch-svn] [commit] r5163 - in freeswitch/trunk: libs/iax/src src/mod/endpoints/mod_iax
Freeswitch SVN
mikej at freeswitch.org
Fri May 11 22:40:32 EDT 2007
Author: mikej
Date: Fri May 11 22:40:32 2007
New Revision: 5163
Modified:
freeswitch/trunk/libs/iax/src/iax-client.h
freeswitch/trunk/libs/iax/src/iax.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
Log:
inital stubs for a few inbound reg helper functions. prototypes likely to change.
Modified: freeswitch/trunk/libs/iax/src/iax-client.h
==============================================================================
--- freeswitch/trunk/libs/iax/src/iax-client.h (original)
+++ freeswitch/trunk/libs/iax/src/iax-client.h Fri May 11 22:40:32 2007
@@ -162,6 +162,9 @@
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);
Modified: freeswitch/trunk/libs/iax/src/iax.c
==============================================================================
--- freeswitch/trunk/libs/iax/src/iax.c (original)
+++ freeswitch/trunk/libs/iax/src/iax.c Fri May 11 22:40:32 2007
@@ -1255,7 +1255,11 @@
#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 @@
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;
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Fri May 11 22:40:32 2007
@@ -1038,9 +1038,7 @@
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;
More information about the Freeswitch-svn
mailing list