def send_digits(digits)
      raise "Media not started" unless @media
      delay = (0.250 * MSEC).to_i # FIXME: Need to pass this down to the media layer
      digits.split('').each do |digit|
        raise ArgumentError, "Invalid DTMF digit requested: #{digit}" unless VALID_DTMF.include? digit

        case @dtmf_mode
        when :rfc2833
          @media << "dtmf:#{digit}"
          @media << "silence:#{delay}"
        when :info
          info = <<-INFO

INFO [next_url] SIP/2.0
Via: SIP/2.0/[transport] #{@adv_ip}:[local_port];branch=[branch]
From: "#{@from_user}" <sip:#{@from_user}@#{@adv_ip}:[local_port]>;tag=[call_number]
To: <sip:#{to_addr}>[peer_tag_param]
Call-ID: [call_id]
CSeq: [cseq] INFO
Contact: <sip:[$local_addr];transport=[transport]>
Max-Forwards: 100
User-Agent: #{USER_AGENT}
[routes]
Content-Length: [len]
Content-Type: application/dtmf-relay

Signal=#{digit}
Duration=#{delay}
          INFO
          send info
          recv response: 200
          pause delay
        end
      end

      if @dtmf_mode == :rfc2833
        pause delay * 2 * digits.size
      end
    end
def send_digits(digits)
      raise "Media not started" unless @media
      delay = (0.250 * MSEC).to_i # FIXME: Need to pass this down to the media layer
      digits.split('').each do |digit|
        raise ArgumentError, "Invalid DTMF digit requested: #{digit}" unless VALID_DTMF.include? digit

        case @dtmf_mode
        when :rfc2833
          @media << "dtmf:#{digit}"
          @media << "silence:#{delay}"
        when :info
          info = <<-INFO

INFO [next_url] SIP/2.0
Via: SIP/2.0/[transport] #{@adv_ip}:[local_port];branch=[branch]
From: "#{@from_user}" <sip:#{@from_user}@#{@adv_ip}:[local_port]>;tag=[call_number]
To: <sip:#{to_addr}>[peer_tag_param]
Call-ID: [call_id]
CSeq: [cseq] INFO
Contact: <sip:[$local_addr];transport=[transport]>
Max-Forwards: 100
User-Agent: #{USER_AGENT}
[routes]
Content-Length: [len]
Content-Type: application/dtmf-relay

Signal=#{digit}
Duration=#{delay}
          INFO
          send info
          recv response: 200
          pause delay
        end
      end

      if @dtmf_mode == :rfc2833
        pause delay * 2 * digits.size
      end
    end
Send DTMF digits

 @param [String] DTMF digits to send. Must be 0-9, *, # or A-D

 @example Send a single DTMF digit
   send_digits '1'

 @example Enter a pin number
   send_digits '1234'