inital stubs for a few inbound reg helper functions. prototypes likely to change.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5163 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-05-12 02:40:32 +00:00
parent 5045ba88ba
commit aacca3467b
3 changed files with 27 additions and 4 deletions

View 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);

View 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;

View 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;