Documentation
¶
Index ¶
- Constants
- Variables
- func BuildIMSCPIMIMDNMessageHeaders(from, to, messageID string, notifications []string) map[string][]string
- func BuildIMSCPIMMessage(from, to, contentType string, body []byte) ([]byte, error)
- func BuildIMSCPIMMessageWithHeaders(messageHeaders, contentHeaders map[string][]string, body []byte) ([]byte, error)
- func BuildIMSUSSDXML(payload IMSUSSDPayload) ([]byte, error)
- func BuildSMSRPAck(rpMR byte) []byte
- func BuildSMSRPAckWithTPDU(rpMR byte, tpdu []byte) ([]byte, error)
- func BuildSMSRPData(rpMR byte, smsc string, tpdu []byte) ([]byte, error)
- func BuildSMSRPError(rpMR byte, cause byte) []byte
- func BuildSMSRPErrorWithDiagnostics(rpMR byte, cause byte, diagnostics []byte, tpdu []byte) ([]byte, error)
- func BuildSMSStatusReportTPDU(report SMSStatusReport) ([]byte, error)
- func BuildSMSSubmitTPDU(to string, part SMSPart, mr byte) ([]byte, error)
- func IMSMessagingSMSSubmitIdempotencyKey(req SMSSendRequest) string
- func IMSMessagingUSSDSessionKey(req USSDRequest) string
- func IMSRegistrationRecoveryNeededStatus(code int) bool
- func IMSRegistrationRecoveryRetryAfter(err error) time.Duration
- func IsIMSRegistrationRecoveryError(err error) bool
- func NormalizeIMSIMDNDispositionNotifications(values ...string) []string
- func ParseSMSRPData(body []byte) (rpMR byte, tpdu []byte, err error)
- func ParseSMSRPErrorCause(body []byte) (byte, error)
- func RPCauseText(code int) string
- func SMSStatusReportText(status byte) string
- func WithSuppressSendTGSuccess(ctx context.Context) context.Context
- type DeliveryPartMatch
- type DeliveryPartStatus
- type DeliveryStatus
- type DeliveryStore
- type IMSCPIMIMDNDispositionRequest
- type IMSCPIMMessage
- type IMSMessageRequest
- type IMSMessageResult
- type IMSMessagingRecoveryCandidate
- type IMSMessagingRecoveryCandidateKind
- type IMSMessagingRetryAction
- type IMSMessagingRetryClass
- type IMSMessagingRetryDueStore
- type IMSMessagingRetryEnvelope
- func NewIMSMessagingRetryEnvelope(plan IMSMessagingRetryPlan, payload IMSMessagingRetryPayload, now time.Time) IMSMessagingRetryEnvelope
- func NewIMSSMSSubmitRetryEnvelope(req SMSSendRequest, result SMSSendResult, err error, ...) IMSMessagingRetryEnvelope
- func NewIMSUSSDSessionRetryEnvelope(req USSDRequest, result USSDResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryEnvelope
- func SelectDueIMSMessagingRetryEnvelopes(envelopes []IMSMessagingRetryEnvelope, now time.Time, limit int) []IMSMessagingRetryEnvelope
- func (e IMSMessagingRetryEnvelope) Due(now time.Time) bool
- func (e IMSMessagingRetryEnvelope) Pending() bool
- func (e IMSMessagingRetryEnvelope) ReplayReady(now time.Time) bool
- func (e IMSMessagingRetryEnvelope) SMSSubmitRequest() (SMSSendRequest, bool)
- func (e IMSMessagingRetryEnvelope) Terminal() bool
- func (e IMSMessagingRetryEnvelope) USSDRequest() (USSDRequest, bool)
- type IMSMessagingRetryInput
- type IMSMessagingRetryOperation
- type IMSMessagingRetryOptions
- type IMSMessagingRetryPayload
- type IMSMessagingRetryPlan
- func PlanIMSMessagingRetry(input IMSMessagingRetryInput) IMSMessagingRetryPlan
- func PlanIMSSMSSubmitRetry(req SMSSendRequest, result SMSSendResult, err error, ...) IMSMessagingRetryPlan
- func PlanIMSUSSDSessionRetry(req USSDRequest, result USSDResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryPlan
- type IMSMessagingRetryPolicy
- type IMSMessagingRetryQueue
- type IMSMessagingRetryQueueState
- type IMSMessagingRetryReplayResult
- type IMSMessagingRetryStore
- type IMSMessagingSIPRecoveryDecision
- type IMSRegistrationRecoveryError
- type IMSSMSTransport
- type IMSUSSDDialogRequest
- type IMSUSSDDialogResult
- type IMSUSSDDialogTransport
- type IMSUSSDOperation
- type IMSUSSDPayload
- type IMSUSSDTransport
- func (t *IMSUSSDTransport) CancelUSSD(ctx context.Context, req USSDRequest) error
- func (t *IMSUSSDTransport) ContinueUSSD(ctx context.Context, req USSDRequest) (USSDResult, error)
- func (t *IMSUSSDTransport) ExecuteUSSD(ctx context.Context, req USSDRequest) (USSDResult, error)
- func (t *IMSUSSDTransport) HandleIMSBye(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
- func (t *IMSUSSDTransport) HandleIMSInfo(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
- type IncomingSMS
- type SMSConcatInfo
- type SMSDataCodingInfo
- type SMSDeliver
- type SMSDeliveryReport
- type SMSPart
- type SMSRPCauseClass
- type SMSRPCauseDisposition
- type SMSRPDU
- type SMSRPDUKind
- type SMSSMSCControlParameters
- type SMSSendRequest
- type SMSSendResult
- type SMSSpecialMessageIndication
- type SMSStatusReport
- type SMSStatusReportClass
- type SMSStatusReportDisposition
- type SMSTransport
- type SMSUDHElement
- type SMSUDHSourceIndicator
- type SMSUserDataHeaderInfo
- type SendOptions
- type SendOutcome
- type Service
- func (s *Service) CancelUSSD(ctx context.Context, sessionID string) error
- func (s *Service) ContinueUSSD(ctx context.Context, sessionID, input string) (*USSDResult, error)
- func (s *Service) GetSMSDeliveryStatus(messageID string) (*DeliveryStatus, error)
- func (s *Service) HandleIMSMessage(ctx context.Context, msg IMSMessageRequest) (IMSMessageResult, error)
- func (s *Service) HandleIMSUSSDBye(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
- func (s *Service) HandleIMSUSSDInfo(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
- func (s *Service) HandleIncomingSMS(ctx context.Context, msg IncomingSMS) error
- func (s *Service) HandleSMSDeliveryReport(ctx context.Context, report SMSDeliveryReport) (DeliveryPartMatch, error)
- func (s *Service) ReplayDueIMSMessagingRetries(ctx context.Context, envelopes []IMSMessagingRetryEnvelope, now time.Time, ...) ([]IMSMessagingRetryReplayResult, error)
- func (s *Service) ReplayDueIMSMessagingRetriesFromStore(ctx context.Context, now time.Time, limit int) ([]IMSMessagingRetryReplayResult, error)
- func (s *Service) ReplayIMSMessagingRetry(ctx context.Context, envelope IMSMessagingRetryEnvelope, now time.Time) (IMSMessagingRetryReplayResult, error)
- func (s *Service) SendSMSWithOptions(ctx context.Context, to, text string, opts SendOptions) (SendOutcome, error)
- func (s *Service) SendUSSD(ctx context.Context, command string) (*USSDResult, error)
- func (s *Service) SetSMSTransport(t SMSTransport)
- func (s *Service) SetUSSDTransport(t USSDTransport)
- type USSDRequest
- type USSDResult
- type USSDTransport
Constants ¶
const ( IMSIMDNDispositionPositiveDelivery = "positive-delivery" IMSIMDNDispositionNegativeDelivery = "negative-delivery" IMSIMDNDispositionDisplay = "display" IMSIMDNDispositionProcessing = "processing" )
const ( SMSNationalLanguageTurkish = 1 SMSNationalLanguageSpanish = 2 SMSNationalLanguagePortuguese = 3 SMSNationalLanguageBengali = 4 SMSNationalLanguageGujarati = 5 SMSNationalLanguageHindi = 6 SMSNationalLanguageKannada = 7 SMSNationalLanguageMalayalam = 8 SMSNationalLanguageOriya = 9 SMSNationalLanguagePunjabi = 10 SMSNationalLanguageTamil = 11 SMSNationalLanguageTelugu = 12 SMSNationalLanguageUrdu = 13 )
const IMS3GPPSMSContentType = "application/vnd.3gpp.sms"
const IMSCPIMContentType = "message/cpim"
const IMSUSSDContentDisposition = "Info-Package"
const IMSUSSDContentType = "application/vnd.3gpp.ussd+xml"
const IMSUSSDInfoPackage = "g.3gpp.ussd"
const SMSRPCauseTemporaryFailure byte = 41
Variables ¶
var ErrDeliveryNotFound = errors.New("delivery not found")
Functions ¶
func BuildIMSCPIMMessage ¶
func BuildIMSUSSDXML ¶
func BuildIMSUSSDXML(payload IMSUSSDPayload) ([]byte, error)
func BuildSMSRPAck ¶
func BuildSMSRPError ¶
func BuildSMSStatusReportTPDU ¶
func BuildSMSStatusReportTPDU(report SMSStatusReport) ([]byte, error)
func IMSMessagingSMSSubmitIdempotencyKey ¶
func IMSMessagingSMSSubmitIdempotencyKey(req SMSSendRequest) string
func IMSMessagingUSSDSessionKey ¶
func IMSMessagingUSSDSessionKey(req USSDRequest) string
func ParseSMSRPErrorCause ¶
func RPCauseText ¶
func SMSStatusReportText ¶
Types ¶
type DeliveryPartMatch ¶
type DeliveryPartStatus ¶
type DeliveryStatus ¶
type DeliveryStore ¶
type DeliveryStore interface {
CreateSMSDelivery(messageID, imsi, deviceID, peer, content string, partsTotal int, at time.Time) error
UpsertSMSDeliveryPart(messageID string, partNo int, callID string, rpMR int, state string, sentAt time.Time) error
MarkSMSDeliveryPartReport(inReplyTo, callID, deviceID string, rpMR int, state string, sipCode int, rpCause int, errText string, at time.Time) (DeliveryPartMatch, error)
RecomputeSMSDelivery(messageID string, at time.Time) error
UpdateSMSDeliveryState(messageID, state, lastError string, acks int, at time.Time) error
GetSMSDeliveryStatus(messageID string) (*DeliveryStatus, error)
}
type IMSCPIMIMDNDispositionRequest ¶
type IMSCPIMIMDNDispositionRequest struct {
MessageID string
Notifications []string
PositiveDelivery bool
NegativeDelivery bool
Display bool
Processing bool
Required bool
}
func IMSCPIMIMDNDispositionRequestFromHeaders ¶
func IMSCPIMIMDNDispositionRequestFromHeaders(headers map[string][]string) IMSCPIMIMDNDispositionRequest
func ParseIMSCPIMIMDNDispositionRequest ¶
func ParseIMSCPIMIMDNDispositionRequest(cpim IMSCPIMMessage) IMSCPIMIMDNDispositionRequest
func (IMSCPIMIMDNDispositionRequest) Requested ¶
func (r IMSCPIMIMDNDispositionRequest) Requested() bool
type IMSCPIMMessage ¶
type IMSCPIMMessage struct {
Headers map[string][]string
ContentHeaders map[string][]string
ContentType string
ContentTypeParams map[string]string
Body []byte
}
func ParseIMSCPIMMessage ¶
func ParseIMSCPIMMessage(body []byte) (IMSCPIMMessage, error)
type IMSMessageRequest ¶
type IMSMessageResult ¶
type IMSMessageResult struct {
StatusCode int
Reason string
RPDU SMSRPDU
Incoming *IncomingSMS
DeliveryReport *SMSDeliveryReport
ReplyContentType string
ReplyBody []byte
UnsupportedContent bool
}
type IMSMessagingRecoveryCandidate ¶
type IMSMessagingRecoveryCandidate struct {
Kind IMSMessagingRecoveryCandidateKind
StatusCode int
URI string
RetryAfter time.Duration
RetryAfterPresent bool
Weight float64
}
IMSMessagingRecoveryCandidate is a sorted, local recovery option derived from SIP messaging failure metadata.
func IMSMessagingRecoveryCandidatesForSIPResponse ¶
func IMSMessagingRecoveryCandidatesForSIPResponse(resp voiceclient.SIPResponse) []IMSMessagingRecoveryCandidate
IMSMessagingRecoveryCandidatesForSIPResponse extracts target and backoff hints from a SIP response. Candidates are returned from most to least useful for messaging recovery: direct target candidates first, higher q/weight first, and standalone Retry-After backoff only when no direct target is present.
type IMSMessagingRecoveryCandidateKind ¶
type IMSMessagingRecoveryCandidateKind string
const ( IMSMessagingRecoveryCandidateRetryAfter IMSMessagingRecoveryCandidateKind = "retry-after" IMSMessagingRecoveryCandidateRedirectContact IMSMessagingRecoveryCandidateKind = "redirect-contact" IMSMessagingRecoveryCandidateAlternativeService IMSMessagingRecoveryCandidateKind = "alternative-service" )
type IMSMessagingRetryAction ¶
type IMSMessagingRetryAction string
const ( IMSMessagingRetryActionNone IMSMessagingRetryAction = "none" IMSMessagingRetryActionRetry IMSMessagingRetryAction = "retry" IMSMessagingRetryActionRetryAfter IMSMessagingRetryAction = "retry-after" IMSMessagingRetryActionRefreshAuthentication IMSMessagingRetryAction = "refresh-authentication" IMSMessagingRetryActionRecoverRegistration IMSMessagingRetryAction = "recover-registration" IMSMessagingRetryActionFailoverTarget IMSMessagingRetryAction = "failover-target" )
type IMSMessagingRetryClass ¶
type IMSMessagingRetryClass string
const ( IMSMessagingRetryClassAccepted IMSMessagingRetryClass = "accepted" IMSMessagingRetryClassSuccess IMSMessagingRetryClass = "success" IMSMessagingRetryClassRedirect IMSMessagingRetryClass = "redirect" IMSMessagingRetryClassAuthentication IMSMessagingRetryClass = "authentication" IMSMessagingRetryClassClientFailure IMSMessagingRetryClass = "client-failure" IMSMessagingRetryClassThrottled IMSMessagingRetryClass = "throttled" IMSMessagingRetryClassServerFailure IMSMessagingRetryClass = "server-failure" IMSMessagingRetryClassSIPTimeout IMSMessagingRetryClass = "sip-timeout" IMSMessagingRetryClassTransportFailure IMSMessagingRetryClass = "transport-failure" IMSMessagingRetryClassUnknown IMSMessagingRetryClass = "unknown" )
type IMSMessagingRetryDueStore ¶
type IMSMessagingRetryDueStore interface {
ListDueIMSMessagingRetries(now time.Time, limit int) ([]IMSMessagingRetryEnvelope, error)
}
type IMSMessagingRetryEnvelope ¶
type IMSMessagingRetryEnvelope struct {
Version int `json:"version"`
Key string `json:"key"`
Operation IMSMessagingRetryOperation `json:"operation"`
Method string `json:"method,omitempty"`
State IMSMessagingRetryQueueState `json:"state"`
Attempt int `json:"attempt"`
NextAttempt int `json:"next_attempt,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
SessionKey string `json:"session_key,omitempty"`
DueAt time.Time `json:"due_at,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
TerminalAt time.Time `json:"terminal_at,omitempty"`
LastError string `json:"last_error,omitempty"`
Plan IMSMessagingRetryPlan `json:"plan"`
Payload IMSMessagingRetryPayload `json:"payload,omitempty"`
}
func NewIMSMessagingRetryEnvelope ¶
func NewIMSMessagingRetryEnvelope(plan IMSMessagingRetryPlan, payload IMSMessagingRetryPayload, now time.Time) IMSMessagingRetryEnvelope
func NewIMSSMSSubmitRetryEnvelope ¶
func NewIMSSMSSubmitRetryEnvelope(req SMSSendRequest, result SMSSendResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryEnvelope
func NewIMSUSSDSessionRetryEnvelope ¶
func NewIMSUSSDSessionRetryEnvelope(req USSDRequest, result USSDResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryEnvelope
func SelectDueIMSMessagingRetryEnvelopes ¶
func SelectDueIMSMessagingRetryEnvelopes(envelopes []IMSMessagingRetryEnvelope, now time.Time, limit int) []IMSMessagingRetryEnvelope
func (IMSMessagingRetryEnvelope) Pending ¶
func (e IMSMessagingRetryEnvelope) Pending() bool
func (IMSMessagingRetryEnvelope) ReplayReady ¶
func (e IMSMessagingRetryEnvelope) ReplayReady(now time.Time) bool
func (IMSMessagingRetryEnvelope) SMSSubmitRequest ¶
func (e IMSMessagingRetryEnvelope) SMSSubmitRequest() (SMSSendRequest, bool)
func (IMSMessagingRetryEnvelope) Terminal ¶
func (e IMSMessagingRetryEnvelope) Terminal() bool
func (IMSMessagingRetryEnvelope) USSDRequest ¶
func (e IMSMessagingRetryEnvelope) USSDRequest() (USSDRequest, bool)
type IMSMessagingRetryInput ¶
type IMSMessagingRetryInput struct {
Operation IMSMessagingRetryOperation
Method string
Response voiceclient.SIPResponse
Err error
Attempt int
Policy IMSMessagingRetryPolicy
Now time.Time
IdempotencyKey string
SessionKey string
}
type IMSMessagingRetryOperation ¶
type IMSMessagingRetryOperation string
const ( IMSMessagingRetryOperationSMSSubmit IMSMessagingRetryOperation = "sms-submit" IMSMessagingRetryOperationUSSDSession IMSMessagingRetryOperation = "ussd-session" )
type IMSMessagingRetryPayload ¶
type IMSMessagingRetryPayload struct {
SMSSubmit *SMSSendRequest `json:"sms_submit,omitempty"`
USSD *USSDRequest `json:"ussd,omitempty"`
}
type IMSMessagingRetryPlan ¶
type IMSMessagingRetryPlan struct {
Operation IMSMessagingRetryOperation `json:"operation"`
Method string `json:"method,omitempty"`
StatusCode int `json:"status_code,omitempty"`
Class IMSMessagingRetryClass `json:"class"`
Action IMSMessagingRetryAction `json:"action"`
Retry bool `json:"retry"`
Terminal bool `json:"terminal"`
Durable bool `json:"durable"`
Attempt int `json:"attempt"`
NextAttempt int `json:"next_attempt,omitempty"`
MaxAttempts int `json:"max_attempts"`
Delay time.Duration `json:"delay,omitempty"`
RetryAfter time.Duration `json:"retry_after,omitempty"`
RetryAfterPresent bool `json:"retry_after_present,omitempty"`
NextAttemptAt time.Time `json:"next_attempt_at,omitempty"`
RetryKey string `json:"retry_key,omitempty"`
IdempotencyKey string `json:"idempotency_key,omitempty"`
SessionKey string `json:"session_key,omitempty"`
TargetURI string `json:"target_uri,omitempty"`
TargetFailover bool `json:"target_failover,omitempty"`
RegistrationRecoveryNeeded bool `json:"registration_recovery_needed,omitempty"`
AuthenticationRefresh bool `json:"authentication_refresh,omitempty"`
AuthenticationChallengeHeader string `json:"authentication_challenge_header,omitempty"`
AuthenticationChallenge string `json:"authentication_challenge,omitempty"`
AuthenticationAuthorizationHeader string `json:"authentication_authorization_header,omitempty"`
TransportFailure bool `json:"transport_failure,omitempty"`
TimedOut bool `json:"timed_out,omitempty"`
FinalResponseTimeout bool `json:"final_response_timeout,omitempty"`
DuplicateRisk bool `json:"duplicate_risk,omitempty"`
Reason string `json:"reason,omitempty"`
}
IMSMessagingRetryPlan is intentionally durable: it contains no function pointers or transient transport state, so callers can JSON-encode and replay the decision from a local queue.
func PlanIMSMessagingRetry ¶
func PlanIMSMessagingRetry(input IMSMessagingRetryInput) IMSMessagingRetryPlan
func PlanIMSSMSSubmitRetry ¶
func PlanIMSSMSSubmitRetry(req SMSSendRequest, result SMSSendResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryPlan
func PlanIMSUSSDSessionRetry ¶
func PlanIMSUSSDSessionRetry(req USSDRequest, result USSDResult, err error, opts IMSMessagingRetryOptions) IMSMessagingRetryPlan
type IMSMessagingRetryPolicy ¶
type IMSMessagingRetryPolicy struct {
MaxAttempts int `json:"max_attempts,omitempty"`
BaseDelay time.Duration `json:"base_delay,omitempty"`
MaxDelay time.Duration `json:"max_delay,omitempty"`
}
func DefaultIMSMessagingRetryPolicy ¶
func DefaultIMSMessagingRetryPolicy() IMSMessagingRetryPolicy
type IMSMessagingRetryQueue ¶
type IMSMessagingRetryQueue struct {
Envelopes []IMSMessagingRetryEnvelope `json:"envelopes,omitempty"`
}
func (*IMSMessagingRetryQueue) Delete ¶
func (q *IMSMessagingRetryQueue) Delete(operation IMSMessagingRetryOperation, key string)
func (IMSMessagingRetryQueue) Due ¶
func (q IMSMessagingRetryQueue) Due(now time.Time, limit int) []IMSMessagingRetryEnvelope
func (*IMSMessagingRetryQueue) Upsert ¶
func (q *IMSMessagingRetryQueue) Upsert(envelope IMSMessagingRetryEnvelope)
type IMSMessagingRetryQueueState ¶
type IMSMessagingRetryQueueState string
const ( IMSMessagingRetryQueueStatePending IMSMessagingRetryQueueState = "pending" IMSMessagingRetryQueueStateTerminal IMSMessagingRetryQueueState = "terminal" )
type IMSMessagingRetryReplayResult ¶
type IMSMessagingRetryReplayResult struct {
Envelope IMSMessagingRetryEnvelope
NextEnvelope IMSMessagingRetryEnvelope
Replayed bool
Upserted bool
Deleted bool
DuplicateRisk bool
SMSResult SMSSendResult
USSDResult USSDResult
Err error
}
type IMSMessagingRetryStore ¶
type IMSMessagingRetryStore interface {
UpsertIMSMessagingRetry(IMSMessagingRetryEnvelope) error
DeleteIMSMessagingRetry(operation IMSMessagingRetryOperation, key string) error
}
type IMSMessagingSIPRecoveryDecision ¶
type IMSMessagingSIPRecoveryDecision struct {
Method string
StatusCode int
RetryAfter time.Duration
RetryAfterPresent bool
Recoverable bool
TargetFailover bool
RegistrationRecoveryNeeded bool
AuthenticationRefresh bool
AuthenticationChallengeHeader string
AuthenticationChallenge string
AuthenticationAuthorizationHeader string
RedirectURI string
Candidates []IMSMessagingRecoveryCandidate
FailureText string
}
IMSMessagingSIPRecoveryDecision describes the messaging-layer recovery action for a SIP response to SMS MESSAGE or USSD dialog requests.
func ClassifyIMSMessagingSIPResponseRecovery ¶
func ClassifyIMSMessagingSIPResponseRecovery(method string, resp voiceclient.SIPResponse) IMSMessagingSIPRecoveryDecision
ClassifyIMSMessagingSIPResponseRecovery maps the generic SIP response recovery plan into SMS/USSD messaging decisions while preserving the legacy registration recovery statuses used by older runtime hosts.
type IMSRegistrationRecoveryError ¶
func (IMSRegistrationRecoveryError) Error ¶
func (e IMSRegistrationRecoveryError) Error() string
func (IMSRegistrationRecoveryError) Unwrap ¶
func (e IMSRegistrationRecoveryError) Unwrap() error
type IMSSMSTransport ¶
type IMSSMSTransport struct {
Transport voiceclient.SIPRequestTransport
Profile voiceclient.IMSProfile
Registration voiceclient.RegistrationBinding
Domain string
LocalURI string
ContactURI string
RemoteTargetURI string
UserAgent string
ContentType string
SMSC string
UseCPIM bool
IMDNNotifications []string
DisableStatusReports bool
}
func (IMSSMSTransport) SendSMSPart ¶
func (t IMSSMSTransport) SendSMSPart(ctx context.Context, req SMSSendRequest) (SMSSendResult, error)
type IMSUSSDDialogRequest ¶
type IMSUSSDDialogResult ¶
type IMSUSSDDialogTransport ¶
type IMSUSSDDialogTransport interface {
HandleIMSInfo(context.Context, IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
HandleIMSBye(context.Context, IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
}
type IMSUSSDOperation ¶
type IMSUSSDOperation string
const ( IMSUSSDOperationRequest IMSUSSDOperation = "request" IMSUSSDOperationResponse IMSUSSDOperation = "response" IMSUSSDOperationNotify IMSUSSDOperation = "notify" IMSUSSDOperationRelease IMSUSSDOperation = "release" )
type IMSUSSDPayload ¶
type IMSUSSDPayload struct {
Language string
Text string
Operation IMSUSSDOperation
ErrorCode int
HasError bool
AlertingPattern int
HasAlertingPattern bool
RawOperationElement string
}
func DecodeIMSUSSDDocument ¶
func DecodeIMSUSSDDocument(contentType string, body []byte) (IMSUSSDPayload, bool, error)
func ParseIMSUSSDXML ¶
func ParseIMSUSSDXML(body []byte) (IMSUSSDPayload, error)
type IMSUSSDTransport ¶
type IMSUSSDTransport struct {
Transport voiceclient.SIPRequestTransport
Profile voiceclient.IMSProfile
Registration voiceclient.RegistrationBinding
Domain string
LocalURI string
ContactURI string
RemoteTargetURI string
UserAgent string
LocalTag string
Language string
SessionExpires int
// contains filtered or unexported fields
}
func (*IMSUSSDTransport) CancelUSSD ¶
func (t *IMSUSSDTransport) CancelUSSD(ctx context.Context, req USSDRequest) error
func (*IMSUSSDTransport) ContinueUSSD ¶
func (t *IMSUSSDTransport) ContinueUSSD(ctx context.Context, req USSDRequest) (USSDResult, error)
func (*IMSUSSDTransport) ExecuteUSSD ¶
func (t *IMSUSSDTransport) ExecuteUSSD(ctx context.Context, req USSDRequest) (USSDResult, error)
func (*IMSUSSDTransport) HandleIMSBye ¶
func (t *IMSUSSDTransport) HandleIMSBye(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
func (*IMSUSSDTransport) HandleIMSInfo ¶
func (t *IMSUSSDTransport) HandleIMSInfo(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
type IncomingSMS ¶
type SMSConcatInfo ¶
type SMSDataCodingInfo ¶
type SMSDataCodingInfo struct {
Raw byte
Alphabet string
Compressed bool
AutoDelete bool
HasMessageClass bool
MessageClass int
MessageWaiting bool
MessageWaitingActive bool
MessageWaitingDiscard bool
MessageWaitingType string
Reserved bool
}
func ParseSMSDataCodingScheme ¶
func ParseSMSDataCodingScheme(dcs byte) SMSDataCodingInfo
type SMSDeliver ¶
type SMSDeliver struct {
Sender string
Recipient string
Text string
Timestamp time.Time
Concat SMSConcatInfo
FirstOctet byte
ProtocolID byte
DataCodingScheme byte
DataCoding SMSDataCodingInfo
UserDataLength int
UserDataHeader bool
UserDataHeaderInfo SMSUserDataHeaderInfo
MoreMessagesToSend bool
StatusReportIndication bool
ReplyPath bool
RawTPDU []byte
}
func ParseSMSDeliverTPDU ¶
func ParseSMSDeliverTPDU(tpdu []byte) (SMSDeliver, error)
type SMSDeliveryReport ¶
type SMSDeliveryReport struct {
InReplyTo string
CallID string
RPMR int
State string
SIPCode int
RPCause int
ErrorText string
ReportAt time.Time
Recipient string
SentAt time.Time
FirstOctet byte
MoreMessagesToSend bool
StatusReportQualifier bool
UserDataHeader bool
UserDataHeaderInfo SMSUserDataHeaderInfo
ParameterIndicator byte
ProtocolID byte
DataCodingScheme byte
DataCoding SMSDataCodingInfo
UserData string
}
type SMSPart ¶
type SMSPart struct {
PartNo int
TotalParts int
Text string
Encoding string
UDH []byte
ValidityPeriod time.Duration
ValidityDeadline time.Time
ProtocolID byte
DataCodingScheme byte
UseProtocolID bool
UseDataCodingScheme bool
ReplyPath bool
RejectDuplicates bool
ConcatRef int
ConcatRefBits int
ApplicationDestPort int
ApplicationSourcePort int
ApplicationPortBits int
SingleShiftLang int
LockingShiftLang int
RequestStatusReport bool
}
func SegmentSMS ¶
func SegmentSMSWithOptions ¶
func SegmentSMSWithOptions(text string, opts SendOptions) []SMSPart
type SMSRPCauseClass ¶
type SMSRPCauseClass string
const ( SMSRPCauseClassUnknown SMSRPCauseClass = "" SMSRPCauseClassAddressing SMSRPCauseClass = "addressing" SMSRPCauseClassBarring SMSRPCauseClass = "barring" SMSRPCauseClassSubscriber SMSRPCauseClass = "subscriber" SMSRPCauseClassTemporaryNetwork SMSRPCauseClass = "temporary-network" SMSRPCauseClassFacility SMSRPCauseClass = "facility" SMSRPCauseClassProtocol SMSRPCauseClass = "protocol" SMSRPCauseClassInterworking SMSRPCauseClass = "interworking" )
type SMSRPCauseDisposition ¶
type SMSRPCauseDisposition struct {
Cause int
Class SMSRPCauseClass
Text string
Temporary bool
Permanent bool
Retryable bool
Terminal bool
RegistrationRecoverable bool
SubscriberActionNeeded bool
ProtocolError bool
}
SMSRPCauseDisposition describes retry and finality metadata for RP-ERROR causes.
func ClassifySMSRPCause ¶
func ClassifySMSRPCause(cause int) SMSRPCauseDisposition
type SMSRPDU ¶
type SMSRPDU struct {
Kind SMSRPDUKind
RawType byte
MR byte
Cause int
CauseDiagnostics []byte
Originator string
Destination string
TPDU []byte
}
func ParseSMSRPDU ¶
type SMSRPDUKind ¶
type SMSRPDUKind string
const ( SMSRPDUKindUnknown SMSRPDUKind = "UNKNOWN" SMSRPDUKindData SMSRPDUKind = "RP-DATA" SMSRPDUKindAck SMSRPDUKind = "RP-ACK" SMSRPDUKindError SMSRPDUKind = "RP-ERROR" )
type SMSSMSCControlParameters ¶
type SMSSMSCControlParameters struct {
Raw byte
StatusReportTransactionCompleted bool
StatusReportPermanentError bool
StatusReportTemporaryErrorNoMoreAttempts bool
StatusReportTemporaryErrorMoreAttempts bool
CancelSRRForRemainingConcatParts bool
IncludeOriginalUDHInStatusReport bool
ReservedBits byte
}
type SMSSendRequest ¶
type SMSSendResult ¶
type SMSStatusReport ¶
type SMSStatusReport struct {
Reference byte
Recipient string
Timestamp time.Time
DoneAt time.Time
Status byte
State string
FirstOctet byte
MoreMessagesToSend bool
StatusReportQualifier bool
UserDataHeader bool
ParameterIndicator byte
HasParameterIndicator bool
ProtocolID byte
HasProtocolID bool
DataCodingScheme byte
HasDataCodingScheme bool
DataCoding SMSDataCodingInfo
UserDataLength int
UserDataHeaderInfo SMSUserDataHeaderInfo
UserData string
HasUserData bool
RawTPDU []byte
}
func ParseSMSStatusReportTPDU ¶
func ParseSMSStatusReportTPDU(tpdu []byte) (SMSStatusReport, error)
type SMSStatusReportClass ¶
type SMSStatusReportClass string
SMSStatusReportClass groups TP-ST values into the delivery classes defined for SMS-STATUS-REPORT.
const ( SMSStatusReportClassCompleted SMSStatusReportClass = "completed" SMSStatusReportClassTemporaryRetrying SMSStatusReportClass = "temporary-retrying" SMSStatusReportClassPermanentFailure SMSStatusReportClass = "permanent-failure" SMSStatusReportClassTemporaryFailure SMSStatusReportClass = "temporary-failure" SMSStatusReportClassReserved SMSStatusReportClass = "reserved" )
type SMSStatusReportDisposition ¶
type SMSStatusReportDisposition struct {
Status byte
Class SMSStatusReportClass
State string
Text string
Delivered bool
Failed bool
Temporary bool
Permanent bool
ServiceCenterRetrying bool
Terminal bool
Retryable bool
Reserved bool
}
SMSStatusReportDisposition describes carrier retry and finality metadata for an SMS-STATUS-REPORT TP-ST value.
func ClassifySMSStatusReport ¶
func ClassifySMSStatusReport(status byte) SMSStatusReportDisposition
type SMSTransport ¶
type SMSTransport interface {
SendSMSPart(context.Context, SMSSendRequest) (SMSSendResult, error)
}
type SMSUDHElement ¶
type SMSUDHSourceIndicator ¶
type SMSUserDataHeaderInfo ¶
type SMSUserDataHeaderInfo struct {
Raw []byte
Elements []SMSUDHElement
Concat SMSConcatInfo
HasPorts bool
DestinationPort int
SourcePort int
PortBits int
SpecialMessageIndications []SMSSpecialMessageIndication
HasSMSCControl bool
SMSCControl SMSSMSCControlParameters
SourceIndicators []SMSUDHSourceIndicator
HasRFC822EmailHeader bool
RFC822EmailHeaderLength int
HasSingleShift bool
SingleShiftLang int
HasLockingShift bool
LockingShiftLang int
}
type SendOptions ¶
type SendOptions struct {
Encoding string
ValidityPeriod time.Duration
ValidityDeadline time.Time
ProtocolID byte
DataCodingScheme byte
UseProtocolID bool
UseDataCodingScheme bool
ReplyPath bool
RejectDuplicates bool
ConcatRef int
ConcatRefBits int
ApplicationDestPort int
ApplicationSourcePort int
ApplicationPortBits int
SingleShiftLang int
LockingShiftLang int
}
type SendOutcome ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(deviceID, imsi string, store DeliveryStore, dispatch eventhost.Dispatcher) *Service
func (*Service) CancelUSSD ¶
func (*Service) ContinueUSSD ¶
func (*Service) GetSMSDeliveryStatus ¶
func (s *Service) GetSMSDeliveryStatus(messageID string) (*DeliveryStatus, error)
func (*Service) HandleIMSMessage ¶
func (s *Service) HandleIMSMessage(ctx context.Context, msg IMSMessageRequest) (IMSMessageResult, error)
func (*Service) HandleIMSUSSDBye ¶
func (s *Service) HandleIMSUSSDBye(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
func (*Service) HandleIMSUSSDInfo ¶
func (s *Service) HandleIMSUSSDInfo(ctx context.Context, req IMSUSSDDialogRequest) (IMSUSSDDialogResult, error)
func (*Service) HandleIncomingSMS ¶
func (s *Service) HandleIncomingSMS(ctx context.Context, msg IncomingSMS) error
func (*Service) HandleSMSDeliveryReport ¶
func (s *Service) HandleSMSDeliveryReport(ctx context.Context, report SMSDeliveryReport) (DeliveryPartMatch, error)
func (*Service) ReplayDueIMSMessagingRetries ¶
func (s *Service) ReplayDueIMSMessagingRetries(ctx context.Context, envelopes []IMSMessagingRetryEnvelope, now time.Time, limit int) ([]IMSMessagingRetryReplayResult, error)
func (*Service) ReplayDueIMSMessagingRetriesFromStore ¶
func (*Service) ReplayIMSMessagingRetry ¶
func (s *Service) ReplayIMSMessagingRetry(ctx context.Context, envelope IMSMessagingRetryEnvelope, now time.Time) (IMSMessagingRetryReplayResult, error)
func (*Service) SendSMSWithOptions ¶
func (s *Service) SendSMSWithOptions(ctx context.Context, to, text string, opts SendOptions) (SendOutcome, error)
func (*Service) SetSMSTransport ¶
func (s *Service) SetSMSTransport(t SMSTransport)
func (*Service) SetUSSDTransport ¶
func (s *Service) SetUSSDTransport(t USSDTransport)
type USSDRequest ¶
type USSDResult ¶
type USSDResult struct {
SessionID string `json:"session_id,omitempty"`
Text string `json:"text,omitempty"`
RawText string `json:"raw_text,omitempty"`
Status int `json:"status,omitempty"`
DCS int `json:"dcs,omitempty"`
Done bool `json:"done"`
RegistrationRecoveryNeeded bool `json:"registration_recovery_needed,omitempty"`
RetryAfter time.Duration `json:"retry_after,omitempty"`
}
type USSDTransport ¶
type USSDTransport interface {
ExecuteUSSD(context.Context, USSDRequest) (USSDResult, error)
ContinueUSSD(context.Context, USSDRequest) (USSDResult, error)
CancelUSSD(context.Context, USSDRequest) error
}