====== 差别 ====== 这里会显示出您选择的修订版和当前版本之间的差别。
| 后一修订版 | 前一修订版 | ||
|
zh:实际案例指导:astercc支持的sms供应商列表 [2015/02/16 04:06] liuxl 创建 |
zh:实际案例指导:astercc支持的sms供应商列表 [2017/12/12 03:05] (当前版本) |
||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ======astercc支持的SMS供应商列表====== | + | ======astercc支持的短信(SMS)供应商列表====== |
| - | ====短信服务器的坐席工作界面介绍==== | + | =====短信服务器的坐席工作界面介绍===== |
| 为系统或团队添加短信服务器(核心:短信供应商),astercc系统群发短信(注:坐席一次只能发一条信息)时,将使用自带的一个短信供应商(此处以”上海希奥信息科技有限公司“为例,简称:希奥)群发短信。 | 为系统或团队添加短信服务器(核心:短信供应商),astercc系统群发短信(注:坐席一次只能发一条信息)时,将使用自带的一个短信供应商(此处以”上海希奥信息科技有限公司“为例,简称:希奥)群发短信。 | ||
| 行 13: | 行 13: | ||
| {{:zh:模块使用说明:群发信息管理:短信服务器页面1.png?750|}} | {{:zh:模块使用说明:群发信息管理:短信服务器页面1.png?750|}} | ||
| - | ====短信服务器的配置==== | + | ===== 配置短信服务器 ===== |
| 点击[添加]按钮,打开添加短信服务器界面 | 点击[添加]按钮,打开添加短信服务器界面 | ||
| 行 43: | 行 43: | ||
| </note> | </note> | ||
| + | |||
| + | =====短信供应商的四种配置方法===== | ||
| + | ====使用系统自带SMS供应商发送短信==== | ||
| + | 在上面“短信服务器的配置”一节中可知道,系统自带sms服务器供应商是:上海希奥信息科技有限公司。只需购买上海希奥的帐号密码,点击[群发信息管理]->[短信服务器]->[添加],设置好 “用户名”和“密码”,点击[保存]。 | ||
| + | |||
| + | {{:zh:实际案例指导:希奥短信服务器1.png?750|}} | ||
| + | |||
| + | ====使用串口短信猫发送短信==== | ||
| + | 详情请阅读:[[zh:二次开发者指南:如何将串口短信猫与astercc集成|asterCC系统中配置使用串口短信猫]] | ||
| + | |||
| + | ====使用系统列表内SMS供应商发送短信==== | ||
| + | 首先登录服务器,登录后查看短信供应商列表,我们会看到有: | ||
| + | 1.驿家365短信供应商(eaka365) | ||
| + | 2.亿美短信供应商 | ||
| + | 3.瑞特维短信供应商 | ||
| + | 4.点点客短信供应商 | ||
| + | ... ... | ||
| + | <code> vim /home/coder/astercc_dev/astcc_smsman.pl </code> | ||
| + | 如果选择以上列表短信供应商的客户,只需将 [供应商、供应商提供的帐号(或序号)、密码],填写到相应位置。 | ||
| + | |||
| + | ####驿家365短信供应商(eaka365)接口,需要修改{ my $serialpass = '********'; my $key = '*********';} | ||
| + | <file> | ||
| + | sub sms_eaka{ | ||
| + | my $smsStuff = shift; | ||
| + | |||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'pending', `contacttime` = now() WHERE id = '$smsStuff->{'id'}';"; | ||
| + | &executeQuery($query); | ||
| + | |||
| + | my $nsPrefix = 'ns'.(int(rand(8999))+1000); | ||
| + | my $softwareSerialNo = '3SDK-VFG-0130-KKRUR'; | ||
| + | my $serialpass = '********'; | ||
| + | my $key = '*********'; | ||
| + | my $sendTime = ''; | ||
| + | my $mobiles = $smsStuff->{'target'}; | ||
| + | my $smsContent = $batchcontact_archive_list{$smsStuff->{'batchcontact_archive_id'}}{'content'}."【驿家365】"; | ||
| + | my $addSerial = ''; | ||
| + | my $srcCharset = 'UTF-8'; | ||
| + | my $smsPriority = 5; | ||
| + | my $xmldata = '<?xml version="1.0" encoding="'.$srcCharset.'"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><'.$nsPrefix.':sendSMS xmlns:'.$nsPrefix.'="http://sdkhttp.eucp.b2m.cn/"><arg0 xsi:type="xsd:string">'.$softwareSerialNo.'</arg0><arg1 xsi:type="xsd:string">'.$key.'</arg1><arg2 xsi:type="xsd:string">'.$sendTime.'</arg2><arg4 xsi:type="xsd:string">'.$smsContent.'</arg4><arg5 xsi:type="xsd:string">'.$addSerial.'</arg5><arg6 xsi:type="xsd:string">'.$srcCharset.'</arg6><arg7 xsi:type="xsd:int">'.$smsPriority.'</arg7><arg3 xsi:type="xsd:string">'.$mobiles.'</arg3></'.$nsPrefix.':sendSMS></SOAP-ENV:Body></SOAP-ENV:Envelope>'; | ||
| + | my $response = $ua->post('http://sdkhttp.eucp.b2m.cn/sdk/SDKService?wsdl', | ||
| + | 'Host' => 'sdkhttp.eucp.b2m.cn', | ||
| + | 'User-Agent' => 'NuSOAP/0.9.5 (1.123)', | ||
| + | 'Content-Type' => 'text/xml; charset='.$srcCharset, | ||
| + | 'SOAPAction' => '""', | ||
| + | 'Content' => $xmldata | ||
| + | ); | ||
| + | my $response_content = $response->content; | ||
| + | my $response_code = XMLin($response_content); | ||
| + | my $refcode = $response_code->{'S:Body'}->{'ns2:sendSMSResponse'}->{'return'}; | ||
| + | |||
| + | &debug($refcode); | ||
| + | |||
| + | if($refcode eq "0"){ | ||
| + | # success | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status='success',`contacttime`=now() WHERE id='".$smsStuff->{'id'}."';"; | ||
| + | }else{ | ||
| + | # falied | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status='error',`responsenote`='".$refcode."',`contacttime`=now() WHERE id='".$smsStuff->{'id'}."';"; | ||
| + | } | ||
| + | |||
| + | &executeQuery($query); | ||
| + | return; | ||
| + | } | ||
| + | </file> | ||
| + | |||
| + | ####亿美短信供应商接口,需要修改{my $serialpass = '********'; my $key = '********';} | ||
| + | <file> | ||
| + | sub sms_yimei { | ||
| + | my $smsStuff = shift; | ||
| + | |||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'pending', `contacttime` = now() WHERE id = '$smsStuff->{'id'}';"; | ||
| + | &executeQuery($query); | ||
| + | |||
| + | my $nsPrefix = 'ns'.(int(rand(8999))+1000); | ||
| + | my $softwareSerialNo = '6SDK-EMY-6688-KEWMK'; | ||
| + | my $serialpass = '********'; | ||
| + | my $key = '********'; | ||
| + | my $sendTime = ''; | ||
| + | my $mobiles = $smsStuff->{'target'}; | ||
| + | my $smsContent = $batchcontact_archive_list{$smsStuff->{'batchcontact_archive_id'}}{'content'}; | ||
| + | my $addSerial = ''; | ||
| + | my $srcCharset = 'UTF-8'; | ||
| + | my $smsPriority = 5; | ||
| + | my $xmldata = '<?xml version="1.0" encoding="'.$srcCharset.'"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><'.$nsPrefix.':sendSMS xmlns:'.$nsPrefix.'="http://sdkhttp.eucp.b2m.cn/"><arg0 xsi:type="xsd:string">'.$softwareSerialNo.'</arg0><arg1 xsi:type="xsd:string">'.$key.'</arg1><arg2 xsi:type="xsd:string">'.$sendTime.'</arg2><arg4 xsi:type="xsd:string">'.$smsContent.'</arg4><arg5 xsi:type="xsd:string">'.$addSerial.'</arg5><arg6 xsi:type="xsd:string">'.$srcCharset.'</arg6><arg7 xsi:type="xsd:int">'.$smsPriority.'</arg7><arg3 xsi:type="xsd:string">'.$mobiles.'</arg3></'.$nsPrefix.':sendSMS></SOAP-ENV:Body></SOAP-ENV:Envelope>'; | ||
| + | my $response = $ua->post('http://sdk4report.eucp.b2m.cn:8080/sdk/SDKService?wsdl', | ||
| + | 'Host' => 'sdkhttp.eucp.b2m.cn', | ||
| + | 'User-Agent' => 'NuSOAP/0.9.5 (1.123)', | ||
| + | 'Content-Type' => 'text/xml; charset='.$srcCharset, | ||
| + | 'SOAPAction' => '""', | ||
| + | 'Content' => $xmldata | ||
| + | ); | ||
| + | my $response_content = $response->content; | ||
| + | my $response_code = XMLin($response_content); | ||
| + | my $refcode = $response_code->{'S:Body'}->{'ns2:sendSMSResponse'}->{'return'}; | ||
| + | |||
| + | &debug($refcode); | ||
| + | |||
| + | if($refcode eq "0"){ | ||
| + | # success | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status='success',`contacttime`=now() WHERE id='".$smsStuff->{'id'}."';"; | ||
| + | }else{ | ||
| + | # falied | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status='error',`responsenote`='".$refcode."',`contacttime`=now() WHERE id='".$smsStuff->{'id'}."';"; | ||
| + | } | ||
| + | |||
| + | &executeQuery($query); | ||
| + | |||
| + | return; | ||
| + | } | ||
| + | </file> | ||
| + | |||
| + | |||
| + | ####瑞特维短信供应商接口,需要修改{#my $serialNu = '********';#序列号 #my $serialpw = '********';#密码} | ||
| + | <file> | ||
| + | sub sms_dnhttp { | ||
| + | my $smsStuff = shift; | ||
| + | my $message = $batchcontact_archive_list{$smsStuff->{'batchcontact_archive_id'}}{'content'};#内容 | ||
| + | #老版本 | ||
| + | #my $serialNu = '********';#序列号 | ||
| + | #my $serialpw = '********';#密码 | ||
| + | #my $billcode1 = 'sms6007';#计费代码1 | ||
| + | #my $billcode2 = '116';#计费代码2 | ||
| + | |||
| + | #修正 | ||
| + | my $serialNu = '********';#序列号 | ||
| + | my $serialpw = '********';#密码 | ||
| + | my $billcode1 = 'sms60';#计费代码1 | ||
| + | my $billcode2 = '111';#计费代码2 | ||
| + | my $numberCount = 1;#条数 | ||
| + | | ||
| + | #先获取审核信息id | ||
| + | my $audit_response = $ua->post('http://202.85.215.208/SmsService/Service/auditMessage', | ||
| + | { | ||
| + | serialNu => $serialNu, | ||
| + | serialpw => $serialpw, | ||
| + | smcontent => $message, | ||
| + | numberCount => $numberCount, | ||
| + | billcode => $billcode1, | ||
| + | } | ||
| + | ); | ||
| + | my $auditId = $audit_response->content;#获取审核信息id | ||
| + | |||
| + | &debug($auditId); | ||
| + | |||
| + | if ($auditId > 0) { | ||
| + | #进行短信发送 | ||
| + | my $send_response = $ua->post('http://202.85.215.208/SmsService/Service/sendSMS', | ||
| + | { | ||
| + | phonenumber => $smsStuff->{'target'}, | ||
| + | smscontent => $message, | ||
| + | billcode => $billcode2, | ||
| + | seqno => $serialNu, | ||
| + | sendtime => "", | ||
| + | oldpw => $serialpw, | ||
| + | auditId => $auditId, | ||
| + | } | ||
| + | ); | ||
| + | my $backmsg = $send_response->content; | ||
| + | |||
| + | &debug($backmsg); | ||
| + | if($backmsg eq "0"){ | ||
| + | # success | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'success', contacttime = now() WHERE id = '$smsStuff->{'id'}' "; | ||
| + | }else{ | ||
| + | # falied | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'error', responsenote = '$backmsg', contacttime = now() WHERE id = '$smsStuff->{'id'}' "; | ||
| + | } | ||
| + | }else{ | ||
| + | # falied | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'error', responsenote = '$auditId', contacttime = now() WHERE id = '$smsStuff->{'id'}' "; | ||
| + | } | ||
| + | &executeQuery($query); | ||
| + | return; | ||
| + | } | ||
| + | |||
| + | </file> | ||
| + | |||
| + | |||
| + | ####点点客短信供应商接口,需要修改{my $userName = '********';#用户名 my $idString = '********';#密码} | ||
| + | <file> | ||
| + | sub sms_whhttp { | ||
| + | my $smsStuff = shift; | ||
| + | my $msgContent = $batchcontact_archive_list{$smsStuff->{'batchcontact_archive_id'}}{'content'};#内容 | ||
| + | my $userName = '********';#用户名 | ||
| + | my $idType = 1;#明文 | ||
| + | my $idString = '********';#密码 | ||
| + | my $sendTime = '';#为空 立即发送 | ||
| + | my $destNumber = $smsStuff->{'target'};#目标号码 | ||
| + | |||
| + | #进行短信发送 | ||
| + | my $send_response = $ua->post('http://newweb1.dodoca.com:8080/NOSmsPlatform/http/DodocaInterface/smsSendExt', | ||
| + | { | ||
| + | userName => $userName, | ||
| + | idType => $idType, | ||
| + | idString => $idString, | ||
| + | msgContent => $msgContent, | ||
| + | destNumber => $destNumber, | ||
| + | sendTime => $sendTime, | ||
| + | } | ||
| + | ); | ||
| + | |||
| + | my $backmsg = $send_response->content; | ||
| + | my $xmlmsg = XMLin($backmsg); | ||
| + | my @resary = split("," , trim($xmlmsg->{'result'})); | ||
| + | my $backcode = $resary[0]; | ||
| + | |||
| + | &debug($backcode); | ||
| + | |||
| + | if($backcode eq "1"){ | ||
| + | # succ | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'success',responsenote = '$xmlmsg->{'taskId'}', contacttime = now() WHERE id = '$smsStuff->{'id'}' "; | ||
| + | }else{ | ||
| + | # err | ||
| + | $query = "UPDATE ".$db_prefix."batchcontacts SET status = 'error', responsenote = '$xmlmsg->{'result'}', contacttime = now() WHERE id = '$smsStuff->{'id'}' "; | ||
| + | } | ||
| + | &executeQuery($query); | ||
| + | |||
| + | return; | ||
| + | } | ||
| + | sub debug{ | ||
| + | my $message = shift; | ||
| + | my $time=scalar localtime; | ||
| + | if ($debug > 0) { | ||
| + | open (HDW,">>$Bin/astcc_smsman.txt"); | ||
| + | print HDW $time," ",$message,"\n"; | ||
| + | close HDW; | ||
| + | if ($ARGV[0] eq '-d'){ # output to file | ||
| + | |||
| + | }else{ | ||
| + | print $time," ",$message,"\n"; | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | sub trim($) | ||
| + | { | ||
| + | my $string = shift; | ||
| + | $string =~ s/^\s+//; | ||
| + | $string =~ s/\s+$//; | ||
| + | return $string; | ||
| + | } | ||
| + | |||
| + | sub become_daemon { | ||
| + | die "Can't fork" unless defined (my $child = fork); | ||
| + | exit 0 if $child;#kill父进程 | ||
| + | setsid(); | ||
| + | open( STDIN, "</dev/null" ); | ||
| + | open( STDOUT, ">/dev/null" ); | ||
| + | open( STDERR, ">&STDOUT" ); | ||
| + | |||
| + | $SIG{__WARN__} = sub { | ||
| + | &debug ("NOTE! " . join(" ", @_)); | ||
| + | }; | ||
| + | |||
| + | $SIG{__DIE__} = sub { | ||
| + | &debug ("FATAL! " . join(" ", @_)); | ||
| + | unlink $pidFile; | ||
| + | exit; | ||
| + | }; | ||
| + | |||
| + | $SIG{HUP} = $SIG{INT} = $SIG{TERM} = sub { | ||
| + | # Any sort of death trigger results in death of all | ||
| + | my $sig = shift; | ||
| + | $SIG{$sig} = 'IGNORE'; | ||
| + | die "killed by $sig\n"; | ||
| + | exit; | ||
| + | }; | ||
| + | |||
| + | umask(0); | ||
| + | #$ENV{PATH} = '/bin:/sbin:/usr/bin:/usr/sbin'; | ||
| + | return $$; | ||
| + | } | ||
| + | sub connect_mysql | ||
| + | { | ||
| + | my %info = @_; | ||
| + | my $dbh = DBI->connect("DBI:mysql:database=$info{'dbname'};host=$info{'dbhost'};port=$info{'dbport'}",$info{'dbuser'},$info{'dbpasswd'}); | ||
| + | return($dbh); | ||
| + | } | ||
| + | |||
| + | sub executeQuery | ||
| + | { | ||
| + | my $query = shift; | ||
| + | return if ($query eq ''); | ||
| + | |||
| + | my $queryType = shift; | ||
| + | |||
| + | if (!$dbh->ping) { | ||
| + | &debug("Reconnect database"); | ||
| + | $dbh = &connect_mysql(%dbInfo); | ||
| + | } | ||
| + | if ($debug > 10 && $internal_debug >0) { | ||
| + | &debug("$query"); | ||
| + | } | ||
| + | $dbh->do("SET NAMES 'utf8'"); | ||
| + | if ($queryType eq '') { | ||
| + | my $affect = $dbh->do($query) or &debug($dbh->errstr."($query)"); | ||
| + | if ($affect eq '0E0'){ | ||
| + | return 0; | ||
| + | }else{ | ||
| + | return $affect; | ||
| + | } | ||
| + | }elsif ($queryType eq 'rows'){ | ||
| + | my $rows = $dbh->prepare($query); | ||
| + | $rows->execute() or &debug($dbh->errstr); | ||
| + | return $rows; | ||
| + | }elsif ($queryType eq 'insert'){ | ||
| + | $dbh->do($query) or &debug($dbh->errstr); | ||
| + | return $dbh->{q{mysql_insertid}}; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </file> | ||
| + | ====使用第三方短信平台发送短信==== | ||
| + | 详情请阅读:[[zh:二次开发者指南:如何使用第三方短信平台发送短信|asterCC使用第三方短信平台发送短信]] | ||
| + | |||