1 /*
2  * Copyright (C) 2006 Stefan Sayer
3  *
4  * This file is part of SEMS, a free SIP media server.
5  *
6  * SEMS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version. This program is released under
10  * the GPL with the additional exemption that compiling, linking,
11  * and/or using OpenSSL is allowed.
12  *
13  * For a license to use the SEMS software under conditions
14  * other than those described here, or to purchase support for this
15  * software, please contact iptel.org by e-mail at the following addresses:
16  *    info@iptel.org
17  *
18  * SEMS is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26  */
27 
28 #include "AmUAC.h"
29 #include "AmSipMsg.h"
30 #include "AmSession.h"
31 #include "AmSessionContainer.h"
32 #include "AmConfig.h"
33 
34 /* TODO: add max_forwards parameter in order to allow decreasing of
35    Max-Forwards value in DSM and IVR scripts.
36 */
dialout(const string & user,const string & app_name,const string & r_uri,const string & from,const string & from_uri,const string & to,const string & local_tag,const string & hdrs,AmArg * session_params)37 string AmUAC::dialout(const string& user,
38 		      const string& app_name,
39 		      const string& r_uri,
40 		      const string& from,
41 		      const string& from_uri,
42 		      const string& to,
43 		      const string& local_tag,
44 		      const string& hdrs,
45 		      AmArg*  session_params) {
46 
47   AmSipRequest req;
48   string m_app_name = app_name;
49 
50   req.user     = user;
51   req.method   = "INVITE";
52   req.r_uri    = r_uri;
53   req.from     = from;
54   req.from_uri = from_uri;
55   if (!local_tag.length())
56     req.from_tag   = AmSession::getNewId();
57   else
58     req.from_tag   = local_tag;
59   req.to       = to;
60   req.to_tag   = "";
61   req.callid   = AmSession::getNewId();
62   req.hdrs     = hdrs;
63 
64   return AmSessionContainer::instance()->startSessionUAC(req, m_app_name, session_params);
65 }
66 
67