SafeDispatch/SipComponent/Excera/ExceraSipMessageGenerator.cs

32 lines
1.2 KiB
C#
Raw Permalink Normal View History

2024-02-22 16:43:59 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Independentsoft.Sip.Methods;
using Independentsoft.Sip;
namespace SipComponent.Excera
{
public class ExceraSipMessageGenerator : SipMessageGenerator
{
public override Message Generate(string destinationID, string senderID, string sipServer, int sipServerPort, string text, bool groupSms = false)
{
Message sipMessage = base.Generate(destinationID, senderID, sipServer, sipServerPort, text);
sipMessage.ContentType = "application/octet-stream";
sipMessage.Header.Add("Content-Encoding", "base64");
sipMessage.Header.Add("Ais-Msg-Options", "service-attributes;transmission-type=defined;coding=unicode-16;rate=three-quarter");
if (groupSms)
sipMessage.Header.Add("Ais-Reach", "group");
else
sipMessage.Header.Add("Ais-Reach", "individual");
sipMessage.Header.Add("Ais-Service", "short-data");
sipMessage.Body = Convert.ToBase64String(Encoding.BigEndianUnicode.GetBytes(text));
return sipMessage;
}
}
}