Codename Pineapple

Home page | Mailing list | Docs

Last updated: Sat Feb 3 05:00:56 2007

Asterisk developer's documentation :: Codename Pineapple


sip3_cli.c

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 1999 - 2006, Digium, Inc.
00005  *
00006  * Mark Spencer <markster@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*!
00020  * \file
00021  * \brief Various SIP transfer/refer functions
00022  * Version 3 of chan_sip
00023  *
00024  * \author Mark Spencer <markster@digium.com>
00025  * \author Olle E. Johansson <oej@edvina.net> (all the chan_sip3 changes)
00026  *
00027  * See Also:
00028  * \arg \ref AstCREDITS
00029  *
00030  */
00031 
00032 #include "asterisk.h"
00033 
00034 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 45645 $")
00035 
00036 #include <stdio.h>
00037 #include <ctype.h>
00038 #include <string.h>
00039 #include <unistd.h>
00040 #include <sys/socket.h>
00041 #include <sys/ioctl.h>
00042 #include <net/if.h>
00043 #include <errno.h>
00044 #include <stdlib.h>
00045 #include <fcntl.h>
00046 #include <netdb.h>
00047 #include <signal.h>
00048 #include <sys/signal.h>
00049 #include <netinet/in.h>
00050 #include <netinet/in_systm.h>
00051 #include <arpa/inet.h>
00052 #include <netinet/ip.h>
00053 #include <regex.h>
00054 
00055 #include "asterisk/lock.h"
00056 #include "asterisk/channel.h"
00057 #include "asterisk/config.h"
00058 #include "asterisk/logger.h"
00059 #include "asterisk/module.h"
00060 #include "asterisk/pbx.h"
00061 #include "asterisk/options.h"
00062 #include "asterisk/lock.h"
00063 #include "asterisk/sched.h"
00064 #include "asterisk/io.h"
00065 #include "asterisk/rtp.h"
00066 #include "asterisk/udptl.h"
00067 #include "asterisk/acl.h"
00068 #include "asterisk/manager.h"
00069 #include "asterisk/callerid.h"
00070 #include "asterisk/cli.h"
00071 #include "asterisk/app.h"
00072 #include "asterisk/musiconhold.h"
00073 #include "asterisk/dsp.h"
00074 #include "asterisk/features.h"
00075 #include "asterisk/acl.h"
00076 #include "asterisk/srv.h"
00077 #include "asterisk/astdb.h"
00078 #include "asterisk/causes.h"
00079 #include "asterisk/utils.h"
00080 #include "asterisk/file.h"
00081 #include "asterisk/astobj.h"
00082 #include "asterisk/dnsmgr.h"
00083 #include "asterisk/devicestate.h"
00084 #include "asterisk/linkedlists.h"
00085 #include "asterisk/stringfields.h"
00086 #include "asterisk/monitor.h"
00087 #include "asterisk/localtime.h"
00088 #include "asterisk/abstract_jb.h"
00089 #include "asterisk/compiler.h"
00090 #include "sip3.h"
00091 
00092 /*! \brief Table to convert from REFER status variable to string */
00093 static const struct c_referstatusstring {
00094    enum referstatus status;
00095    char *text;
00096 } referstatusstrings[] = {
00097    { REFER_IDLE,     "<none>" },
00098    { REFER_SENT,     "Request sent" },
00099    { REFER_RECEIVED, "Request received" },
00100    { REFER_ACCEPTED, "Accepted" },
00101    { REFER_RINGING,  "Target ringing" },
00102    { REFER_200OK,    "Done" },
00103    { REFER_FAILED,      "Failed" },
00104    { REFER_NOAUTH,      "Failed - auth failure" }
00105 } ;
00106 
00107 
00108 /*! \brief Convert transfer status to string */
00109 char *referstatus2str(enum referstatus rstatus)
00110 {
00111    int i = (sizeof(referstatusstrings) / sizeof(referstatusstrings[0]));
00112    int x;
00113 
00114    for (x = 0; x < i; x++) {
00115       if (referstatusstrings[x].status ==  rstatus)
00116          return (char *) referstatusstrings[x].text;
00117    }
00118    return "";
00119 }
00120 

Asterisk is a trademark for Digium, inc.. | Edvina.net | Asterisk.org | This documentation was generated with Doxygen