![]() |
Home page |
Mailing list |
Docs
Asterisk developer's documentation :: Codename Pineapple
sip3_utils.c File Reference
Version 3 of chan_sip
Definition in file sip3_utils.c.
#include "asterisk.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <errno.h>
#include <stdlib.h>
#include <fcntl.h>
#include <netdb.h>
#include <signal.h>
#include <sys/signal.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <arpa/inet.h>
#include <netinet/ip.h>
#include <regex.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/logger.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/options.h"
#include "asterisk/sched.h"
#include "asterisk/io.h"
#include "asterisk/manager.h"
#include "asterisk/acl.h"
#include "asterisk/utils.h"
#include "asterisk/file.h"
#include "asterisk/astobj.h"
#include "asterisk/dnsmgr.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
#include "asterisk/monitor.h"
#include "asterisk/localtime.h"
#include "asterisk/compiler.h"
#include "sip3.h"
#include "sip3funcs.h"
Include dependency graph for sip3_utils.c:

Go to the source code of this file.
Functions | |
| GNURK void | append_history_full (struct sip_dialog *dialog, const char *fmt,...) |
| Append to SIP dialog history with arg list. | |
| GNURK void GNURK void | append_history_va (struct sip_dialog *p, const char *fmt, va_list ap) |
| Append to SIP dialog history with arg list. | |
| GNURK void | logdebug (int level, const char *fmt,...) |
| Append to SIP dialog history with arg list. | |
| GNURK void static void | logdebug_va (int level, const char *fmt, va_list ap) |
| Output message to LOG_DEBUG channel. | |
| GNURK void | sip_dump_history (struct sip_dialog *dialog) |
| Dump SIP history to debug log file at end of lifespan for SIP dialog. | |
|
||||||||||||||||
|
Append to SIP dialog history with arg list.
Definition at line 127 of file sip3_utils.c. References append_history_va(). 00128 { 00129 va_list ap; 00130 00131 if (!dialog) 00132 return; 00133 va_start(ap, fmt); 00134 append_history_va(dialog, fmt, ap); 00135 va_end(ap); 00136 00137 return; 00138 }
|
|
||||||||||||||||
|
Append to SIP dialog history with arg list.
Definition at line 107 of file sip3_utils.c. References ast_calloc, AST_LIST_INSERT_TAIL, free, and strsep(). 00108 { 00109 char buf[80], *c = buf; /* max history length */ 00110 struct sip_history *hist; 00111 int l; 00112 00113 vsnprintf(buf, sizeof(buf), fmt, ap); 00114 strsep(&c, "\r\n"); /* Trim up everything after \r or \n */ 00115 l = strlen(buf) + 1; 00116 if (!(hist = ast_calloc(1, sizeof(*hist) + l))) 00117 return; 00118 if (!p->history && !(p->history = ast_calloc(1, sizeof(*p->history)))) { 00119 free(hist); 00120 return; 00121 } 00122 memcpy(hist->event, buf, l); 00123 AST_LIST_INSERT_TAIL(p->history, hist, list); 00124 }
|
|
||||||||||||||||
|
Append to SIP dialog history with arg list.
Definition at line 92 of file sip3_utils.c. References logdebug_va(). Referenced by load_module(), and sip_destroy_device(). 00093 { 00094 va_list ap; 00095 00096 va_start(ap, fmt); 00097 logdebug_va(level, fmt, ap); 00098 va_end(ap); 00099 00100 return; 00101 }
|
|
||||||||||||||||
|
Output message to LOG_DEBUG channel.
Definition at line 85 of file sip3_utils.c. References ast_log(), LOG_DEBUG, and option_debug. Referenced by logdebug(). 00086 { 00087 if (option_debug >= level) 00088 ast_log(LOG_DEBUG, fmt, ap); 00089 }
|
|
|
Dump SIP history to debug log file at end of lifespan for SIP dialog.
Definition at line 141 of file sip3_utils.c. References AST_LIST_TRAVERSE, ast_log(), sip_history::event, sip_dialog::history, LOG_DEBUG, LOG_NOTICE, option_debug, sipdebug, and sip_dialog::subscribed. 00142 { 00143 int x = 0; 00144 struct sip_history *hist; 00145 00146 if (!dialog) 00147 return; 00148 00149 if (!option_debug && !sipdebug) { 00150 ast_log(LOG_NOTICE, "You must have debugging enabled (SIP or Asterisk) in order to dump SIP history.\n"); 00151 return; 00152 } 00153 00154 ast_log(LOG_DEBUG, "\n---------- SIP HISTORY for '%s' \n", dialog->callid); 00155 if (dialog->subscribed) 00156 ast_log(LOG_DEBUG, " * Subscription\n"); 00157 else 00158 ast_log(LOG_DEBUG, " * SIP Call\n"); 00159 if (dialog->history) 00160 AST_LIST_TRAVERSE(dialog->history, hist, list) 00161 ast_log(LOG_DEBUG, " %-3.3d. %s\n", ++x, hist->event); 00162 if (!x) 00163 ast_log(LOG_DEBUG, "Call '%s' has no history\n", dialog->callid); 00164 ast_log(LOG_DEBUG, "\n---------- END SIP HISTORY for '%s' \n", dialog->callid); 00165 }
|