⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample_plugin.c

📁 partysip 插件开发 简单的一个小例子
💻 C
字号:
/*  The sample_plugin plugin is a plugin for partysip.  Copyright (C) 2002  Aymeric MOIZARD - <jack@atosc.org>    The sample_plugin plugin is free software; you can redistribute it and/or modify  it under the terms of the GNU General Public License as published by  the Free Software Foundation; either version 2 of the License, or  (at your option) any later version.    The sample_plugin plugin is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License for more details.  You should have received a copy of the GNU General Public License  along with sample_plugin; if not, write to the Free Software  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*/#include "../config.h"#include <partysip/partysip.h>#include "sample_plugin.h"#include <osip/smsg.h>sample_plugin_ctx_t *sample_plugin_context = NULL;extern psp_plugin_t PPL_DECLARE_DATA sample_plugin_plugin;intsample_plugin_ctx_init(){  sample_plugin_context = (sample_plugin_ctx_t*)smalloc(sizeof(sample_plugin_ctx_t));  if (sample_plugin_context==NULL) return -1;    return 0;}voidsample_plugin_ctx_free(){  sfree(sample_plugin_context);  sample_plugin_context = NULL;}/* HOOK METHODS *//*  This method returns:  -2 if plugin consider this request should be totally discarded!  -1 on error  0  nothing has been done  1  things has been done on psp_req element*/int cb_sample_plugin_on_INVITE(psp_req_t *psp_req){  TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL3,NULL,	      "INFO: sample_plugin plugin: cb_sample_plugin_on_INVITE\n"));    psp_req_set_mode(psp_req, PSP_SLESS_MODE);  psp_req_set_state(psp_req, PSP_CONTINUE);  return 0;}int cb_sample_plugin_on_2XX(psp_req_t *psp_req){    TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL3,NULL,	      "INFO: sample_plugin plugin: cb_sample_plugin_on_2XX.\n"));  psp_req_set_mode(psp_req, PSP_SLESS_MODE);  psp_req_set_state(psp_req, PSP_CONTINUE);  return 0;}int cb_sample_plugin_on_3456XX(psp_req_t *psp_req){    TRACE(trace(__FILE__,__LINE__,TRACE_LEVEL3,NULL,	      "INFO: sample_plugin plugin: cb_sample_plugin_on_3456XX.\n"));  psp_req_set_mode(psp_req, PSP_SLESS_MODE);  psp_req_set_state(psp_req, PSP_CONTINUE);  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -