📄 nua_glib.c
字号:
*/ signals[NGSIG_CALL_STATE_CHANGED] = g_signal_new("call-state-changed", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_INT_INT_INT_STRING_STRING, G_TYPE_NONE, 7, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING); /** * NuaGlib::incoming-active: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * * Emitted when a call goes active. */ signals[NGSIG_INCOMING_ACTIVE] = g_signal_new("incoming-active", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /** * NuaGlib::call-terminated: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing callA * @status: SIP status of termination (see SIP RFC) * * This will be emitted after a call has been terminated. * * A call is terminated, when * 1) an error response (300..599) is sent to an incoming initial INVITE * 2) a reliable response (200..299 or reliable preliminary response) to an * incoming initial INVITE is not acknowledged with ACK or PRACK * 3) BYE is received or sent * * Any references you hold to @op should be dropped at this point */ signals[NGSIG_CALL_TERMINATED] = g_signal_new("call-terminated", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT); /** * NuaGlib::incoming-prack: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @rack: pointer to RAck that was PRACKed FIXME!!! * * Emitted when a PRACK is received */ signals[NGSIG_INCOMING_PRACK] = g_signal_new("incoming-prack", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); /** * NuaGlib::incoming-bye: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * */ signals[NGSIG_INCOMING_BYE] = g_signal_new("incoming-bye", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /** * NuaGlib::incoming-cancel: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of cancel (see SIP RFC) * @phrase: Reason for cancel * * Emitted when incoming INVITE has been cancelled or no ACK has * been received for an accepted call. */ signals[NGSIG_INCOMING_CANCEL] = g_signal_new("incoming-cancel", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /** * NuaGlib::incoming-message: * @nua_glib: the object that received the signal * @op: pointer to the operation created to represent this call * @display: the display name of the invite recipient * @url: the url of the invite recipient * @subject: the subject of the invite (can be NULL) * * Emitted when a message is received */ signals[NGSIG_INCOMING_MESSAGE] = g_signal_new("incoming-message", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_STRING_STRING_STRING_STRING, G_TYPE_NONE, 5, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); /** * NuaGlib::incoming-info: * @nua_glib: the object that received the signal * @op: pointer to the operation created to represent this call * @display_name: the display name of the info sender * @address: the address of the info sender * @subject: the subject of the invite (can be NULL) * * Emitted when an INFO message is received */ signals[NGSIG_INCOMING_INFO] = g_signal_new("incoming-info", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_STRING_STRING_STRING, G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); /** * NuaGlib::incoming-refer: * @nua_glib: the object that received the signal * @op: pointer to the operation for the call that originated this refer * @display: the display name of the REFERER * @address: the address of the REFERER * @refer_address: the address you have been requested to refer to * @op2: a pointer to an operation to use to respond to this refer, NULL if * REFER url was not a SIP uri. * * Emitted when a REFER message is received * You should reply to this with #nua_glib_notify to cancel it or * #nua_glib_follow_refer, and probably close * the call that referred * you to follow it. */ signals[NGSIG_INCOMING_REFER] = g_signal_new("incoming-refer", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_STRING_STRING_STRING_POINTER, G_TYPE_NONE, 5, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); /** * NuaGlib::incoming-notify: * @nua_glib: the object that received the signal * @op: pointer to the operation created to represent this call, NULL if * this was a rogue notify * @event: name of event, can be NULL * @content-type: content type of event, can be NULL * @payload: payload of event * * Emitted when an NOTIFY message is received */ signals[NGSIG_INCOMING_NOTIFY] = g_signal_new("incoming-notify", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_STRING_STRING_STRING, G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); /** * NuaGlib::error: * @nua_glib: the object that received the signal * @status: SIP status for error (see SIP RFC) * @phrase: Reason for error * * If you get this, run around waving your hands and screaming. */ signals[NGSIG_ERROR] = g_signal_new("error", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__INT_STRING, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::register-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of REGISTER answer (see SIP RFC) * @phrase: Reason for REGISTER answer * * if status >=300 and not 401 or 407, you should drop any references you hold * on @op */ signals[NGSIG_REGISTER_ANSWERED] = g_signal_new("register-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::unregister-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of REGISTER answer (see SIP RFC) * @phrase: Reason for REGISTER answer * * if status >=300 and not 401 or 407, you should drop any references you hold * on @op */ signals[NGSIG_UNREGISTER_ANSWERED] = g_signal_new("unregister-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::publish-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of PUBLISH answer (see SIP RFC) * @phrase: Reason for PUBLISH answer * * if status >=300 and not 401 or 407, you should drop any references you hold * on @op */ signals[NGSIG_PUBLISH_ANSWERED] = g_signal_new("publish-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::invite-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of INVITE answer (see SIP RFC) * @phrase: Reason for INVITE answer * */ signals[NGSIG_INVITE_ANSWERED] = g_signal_new("invite-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::bye-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of bye answer (see SIP RFC) * @phrase: Reason for bye answer * */ signals[NGSIG_BYE_ANSWERED] = g_signal_new("bye-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::message-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of message answer (see SIP RFC) * @phrase: Reason for message answer * */ signals[NGSIG_MESSAGE_ANSWERED] = g_signal_new("message-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::info-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of INFO answer (see SIP RFC) * @phrase: Reason for INFO answer * */ signals[NGSIG_INFO_ANSWERED] = g_signal_new("info-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::refer-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of REFER answer (see SIP RFC) * @phrase: Reason for REFER answer * */ signals[NGSIG_REFER_ANSWERED] = g_signal_new("refer-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::subscribe-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of SUBSCRIBE answer (see SIP RFC) * @phrase: Reason for SUBSCRIBE answer * */ signals[NGSIG_SUBSCRIBE_ANSWERED] = g_signal_new("subscribe-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::unsubscribe-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of UNSUBSCRIBE answer (see SIP RFC) * @phrase: Reason for UNSUBSCRIBE answer * *You should remove any references you have to @op after receiving this signal */ signals[NGSIG_UNSUBSCRIBE_ANSWERED] = g_signal_new("unsubscribe-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::notify-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of NOTIFY answer (see SIP RFC) * @phrase: Reason for NOTIFY answer * */ signals[NGSIG_NOTIFY_ANSWERED] = g_signal_new("notify-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::options-answered: * @nua_glib: the object that received the signal * @op: pointer to the operation representing the existing call * @status: SIP status of options answer (see SIP RFC) * @phrase: Reason for options answer * */ signals[NGSIG_OPTIONS_ANSWERED] = g_signal_new("options-answered", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_INT_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_STRING); /** * NuaGlib::shutdown: * @nua_glib: the object that received the signal * * The sip stack is shutting down, * drop all #NuaGlibOp references you hold * and unref the object it was emited on */ signals[NGSIG_SHUTDOWN] = g_signal_new("shutdown", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, NULL); /** * NuaGlib::auth_required: * @nua_glib: the object that received the signal * @op: pointer to the related operation * @method: string describing the method (RFC2617: "Basic", "Digest", ..) * @realm: realm of the challenge (RFC2617) * * The sip stack is shutting down, * drop all #NuaGlibOp references you hold * and unref the object it was emited on */ signals[NGSIG_AUTH_REQUIRED] = g_signal_new("auth-required", G_OBJECT_CLASS_TYPE (nua_glib_class), G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL, nua_glib_marshal_VOID__POINTER_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);}/* ====================================================================== */int sof_init(NuaGlibPrivate *priv, const char *contact){ priv->name = "UA"; priv->contact = g_strdup(contact); su_root_threading(priv->root, 0); return 0;}static void sof_callback(nua_event_t event, int status, char const *phrase, nua_t *nua, NuaGlib *self, nua_handle_t *nh, NuaGlibOp *op, sip_t const *sip, tagi_t tags[]){ g_return_if_fail(self); switch (event) { case nua_r_shutdown: sof_r_shutdown(status, phrase, nua, self, nh, op, sip, tags); return; case nua_r_get_params: sof_r_get_params(status, phrase, nua, self, nh, op, sip, tags);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -