/// <summary> Called to send a query </summary> /// <param name="messageId"></param> /// <returns> 1 - Successful / 0 - Failed </returns> public QuerySm SendQuery(string messageId) { QuerySm querySm = null; try { // Capture the next transmitter connection ESMEConnection smppConnection = NextTransmitterConnection(); if (smppConnection.Status != ConnectionStatus.Bound) { WriteLog("ESMEManager : SendMessage : Warning : Not Connected To The SMPP Server"); return(querySm); } // Send the message querySm = smppConnection.SendQuery(messageId); } catch (Exception exception) { WriteLog(LogEventNotificationTypes.Email, "ESMEManager : SendMessage : ERROR : {0}", exception.ToString()); } return(querySm); }
/// <summary> Called to create a QuerySm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> QuerySm </returns> public static QuerySm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { QuerySm querySm = new QuerySm(defaultEncoding); try { buf.ExtractHeader(querySm, ref offset); querySm.MessageId = buf.ExtractCString(ref offset); querySm.SourceTon = buf.ExtractByte(ref offset); querySm.SourceNpi = buf.ExtractByte(ref offset); querySm.SourceAddr = buf.ExtractCString(ref offset); } catch { querySm = null; } return(querySm); }
/// <summary> Called to create a QuerySm object </summary> /// <param name="defaultEncoding"></param> /// <param name="buf"></param> /// <param name="offset"></param> /// <returns> QuerySm </returns> public static QuerySm Create(DataCodings defaultEncoding, SmppBuffer buf, ref int offset) { QuerySm querySm = new QuerySm(defaultEncoding); try { buf.ExtractHeader(querySm, ref offset); querySm.MessageId = buf.ExtractCString(ref offset); querySm.SourceTon = buf.ExtractByte(ref offset); querySm.SourceNpi = buf.ExtractByte(ref offset); querySm.SourceAddr = buf.ExtractCString(ref offset); } catch { querySm = null; } return querySm; }
/// <summary> Called to send a query </summary> /// <param name="messageId"></param> /// <returns> 1 - Successful / 0 - Failed </returns> public QuerySm SendQuery(string messageId) { QuerySm querySm = null; try { if (Client.Status != ConnectionStatus.Bound) { WriteLog("ESMEConnection : SendQuery : Warning : Not Connected To The SMPP Server"); return(querySm); } // Prepare the query querySm = QuerySm.Create(Client.DefaultEncoding, messageId, (byte)Ton.NetworkSpecific, (byte)Npi.Unknown, ShortLongCode); // Send the query QuerySmResp querySmResp = Client.Query(querySm); // Log the send call WriteLog("ESMEConnection : SendQueryThroughSMPP : Send : MessageId[{0}] Sequence[{1}] Status[{2}]", messageId, querySm.Sequence, querySmResp.Status); // Was it successful if (querySmResp.Status != CommandStatus.ESME_ROK) { WriteLog("ESMEConnection : SendQueryThroughSMPP : ERROR : Failed For Unknown Reason"); querySm = null; } } catch (Exception exception) { WriteLog(LogEventNotificationTypes.Email, "ESMEConnection : SendQueryThroughSMPP : ERROR : {0}", exception.ToString()); } return(querySm); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="querySm"></param> /// <param name="commandStatus"></param> /// <returns> QuerySmResp </returns> public static QuerySmResp Create(DataCodings defaultEncoding, QuerySm querySm, CommandStatus commandStatus) { return(new QuerySmResp(defaultEncoding, commandStatus, querySm.Sequence, querySm.MessageId)); }
/// <summary> Called to create a DeliverSmResp object </summary> /// <param name="defaultEncoding"></param> /// <param name="querySm"></param> /// <param name="commandStatus"></param> /// <returns> QuerySmResp </returns> public static QuerySmResp Create(DataCodings defaultEncoding, QuerySm querySm, CommandStatus commandStatus) { return new QuerySmResp(defaultEncoding, commandStatus, querySm.Sequence, querySm.MessageId); }
/// <summary> Called to fire the query pdu event </summary> /// <param name="data"></param> /// <returns> QuerySmResp </returns> internal QuerySmResp OnQuerySm(QuerySm data) { QuerySmResp querySmResp = QuerySmResp.Create(DefaultEncoding, data, CommandStatus.ESME_RSYSERR); querySmResp.MessageId = data.MessageId; try { if (QuerySmEvent != null) { QuerySmEvent(this, data, querySmResp); } } catch { querySmResp = QuerySmResp.Create(DefaultEncoding, CommandStatus.ESME_RSYSERR, data.Sequence); } return querySmResp; }
/// <summary> Query the status of a previously submitted short message </summary> /// <param name="data"></param> /// <returns> QuerySmResp </returns> public QuerySmResp Query(QuerySm data) { QuerySmResp resp = QuerySmResp.Create(DefaultEncoding, data, CommandStatus.ESME_ROK); if (_Status != ConnectionStatus.Bound) { resp = QuerySmResp.Create(DefaultEncoding, CommandStatus.SMPPCLIENT_UNBOUND); return resp; } try { SendPacket(data); } catch (Exception exception) { OnError("Query error : ", exception); resp = QuerySmResp.Create(DefaultEncoding, CommandStatus.SMPPCLIENT_UNKNOWNERROR); } return resp; }